Skip to content

Commit 9bb76d0

Browse files
committed
Rationalise perl header inclusions via a common include file, which also declares routines in plperl.c and spi_internal.c used in other files. Along the way, also stop perl from hijacking stdio and other stuff on Windows.
1 parent 2645cb5 commit 9bb76d0

File tree

5 files changed

+54
-43
lines changed

5 files changed

+54
-43
lines changed

src/pl/plperl/SPI.xs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,7 @@
44
#undef _
55

66
/* perl stuff */
7-
#include "EXTERN.h"
8-
#include "perl.h"
9-
#include "XSUB.h"
10-
#include "ppport.h"
11-
12-
#include "spi_internal.h"
7+
#include "plperl.h"
138

149

1510
/*

src/pl/plperl/plperl.c

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
* ENHANCEMENTS, OR MODIFICATIONS.
3434
*
3535
* IDENTIFICATION
36-
* $PostgreSQL: pgsql/src/pl/plperl/plperl.c,v 1.98 2005/12/29 14:28:31 adunstan Exp $
36+
* $PostgreSQL: pgsql/src/pl/plperl/plperl.c,v 1.99 2006/01/08 22:27:52 adunstan Exp $
3737
*
3838
**********************************************************************/
3939

@@ -60,18 +60,7 @@
6060
extern DLLIMPORT bool check_function_bodies;
6161

6262
/* perl stuff */
63-
#include "EXTERN.h"
64-
#include "perl.h"
65-
#include "XSUB.h"
66-
#include "ppport.h"
67-
#include "spi_internal.h"
68-
69-
/* just in case these symbols aren't provided */
70-
#ifndef pTHX_
71-
#define pTHX_
72-
#define pTHX void
73-
#endif
74-
63+
#include "plperl.h"
7564

7665
/**********************************************************************
7766
* The information we cache about loaded procedures

src/pl/plperl/plperl.h

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/*-------------------------------------------------------------------------
2+
*
3+
* plperl.h
4+
* Common include file for PL/Perl files
5+
*
6+
* This should be included _AFTER_ postgres.h and system include files
7+
*
8+
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
9+
* Portions Copyright (c) 1995, Regents of the University of California
10+
*
11+
* $PostgreSQL: pgsql/src/pl/plperl/plperl.h,v 1.1 2006/01/08 22:27:52 adunstan Exp $
12+
*/
13+
14+
#ifndef PL_PERL_H
15+
#define PL_PERL_H
16+
17+
/* stop perl headers from hijacking stdio and other stuff on Windows */
18+
#ifdef WIN32
19+
#define WIN32IO_IS_STDIO
20+
#endif
21+
22+
/* required for perl API */
23+
#include "EXTERN.h"
24+
#include "perl.h"
25+
#include "XSUB.h"
26+
#include "ppport.h"
27+
28+
/* just in case these symbols aren't provided */
29+
#ifndef pTHX_
30+
#define pTHX_
31+
#define pTHX void
32+
#endif
33+
34+
/* routines from spi_internal.c */
35+
int spi_DEBUG(void);
36+
int spi_LOG(void);
37+
int spi_INFO(void);
38+
int spi_NOTICE(void);
39+
int spi_WARNING(void);
40+
int spi_ERROR(void);
41+
42+
/* routines from plperl.c */
43+
HV *plperl_spi_exec(char *, int);
44+
void plperl_return_next(SV *);
45+
SV *plperl_spi_query(char *);
46+
SV *plperl_spi_fetchrow(char *);
47+
48+
49+
#endif /* PL_PERL_H */

src/pl/plperl/spi_internal.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
/* Defined by Perl */
99
#undef _
1010

11-
#include "spi_internal.h"
12-
11+
/* perl stuff */
12+
#include "plperl.h"
1313

1414
int
1515
spi_DEBUG(void)

src/pl/plperl/spi_internal.h

Lines changed: 0 additions & 22 deletions
This file was deleted.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy