~ubuntu-branches/ubuntu/precise/postgresql-9.1/precise-security

« back to all changes in this revision

Viewing changes to src/pl/plperl/plperl.h

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2011-05-11 10:41:53 UTC
  • Revision ID: james.westby@ubuntu.com-20110511104153-psbh2o58553fv1m0
Tags: upstream-9.1~beta1
ImportĀ upstreamĀ versionĀ 9.1~beta1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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-2011, PostgreSQL Global Development Group
 
9
 * Portions Copyright (c) 1995, Regents of the University of California
 
10
 *
 
11
 * src/pl/plperl/plperl.h
 
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
/*
 
21
 * isnan is defined in both the perl and mingw headers. We don't use it,
 
22
 * so this just clears up the compile warning.
 
23
 */
 
24
#ifdef isnan
 
25
#undef isnan
 
26
#endif
 
27
#endif
 
28
 
 
29
/*
 
30
 * Supply a value of PERL_UNUSED_DECL that will satisfy gcc - the one
 
31
 * perl itself supplies doesn't seem to.
 
32
 */
 
33
#if defined(__GNUC__)
 
34
#define PERL_UNUSED_DECL __attribute__ ((unused))
 
35
#endif
 
36
 
 
37
/*
 
38
 * Sometimes perl carefully scribbles on our *printf macros.
 
39
 * So we undefine them here and redefine them after it's done its dirty deed.
 
40
 */
 
41
 
 
42
#ifdef USE_REPL_SNPRINTF
 
43
#undef snprintf
 
44
#undef vsnprintf
 
45
#endif
 
46
 
 
47
 
 
48
/* required for perl API */
 
49
#include "EXTERN.h"
 
50
#include "perl.h"
 
51
#include "XSUB.h"
 
52
 
 
53
/* put back our snprintf and vsnprintf */
 
54
#ifdef USE_REPL_SNPRINTF
 
55
#ifdef snprintf
 
56
#undef snprintf
 
57
#endif
 
58
#ifdef vsnprintf
 
59
#undef vsnprintf
 
60
#endif
 
61
#ifdef __GNUC__
 
62
#define vsnprintf(...)  pg_vsnprintf(__VA_ARGS__)
 
63
#define snprintf(...)   pg_snprintf(__VA_ARGS__)
 
64
#else
 
65
#define vsnprintf       pg_vsnprintf
 
66
#define snprintf        pg_snprintf
 
67
#endif /* __GNUC__ */
 
68
#endif /*  USE_REPL_SNPRINTF */
 
69
 
 
70
/* perl version and platform portability */
 
71
#define NEED_eval_pv
 
72
#define NEED_newRV_noinc
 
73
#define NEED_sv_2pv_flags
 
74
#include "ppport.h"
 
75
 
 
76
/* perl may have a different width of "bool", don't buy it */
 
77
#ifdef bool
 
78
#undef bool
 
79
#endif
 
80
 
 
81
/* supply HeUTF8 if it's missing - ppport.h doesn't supply it, unfortunately */
 
82
#ifndef HeUTF8
 
83
#define HeUTF8(he)                         ((HeKLEN(he) == HEf_SVKEY) ?                    \
 
84
                                                                SvUTF8(HeKEY_sv(he)) :                             \
 
85
                                                                (U32)HeKUTF8(he))
 
86
#endif
 
87
 
 
88
/* declare routines from plperl.c for access by .xs files */
 
89
HV                 *plperl_spi_exec(char *, int);
 
90
void            plperl_return_next(SV *);
 
91
SV                 *plperl_spi_query(char *);
 
92
SV                 *plperl_spi_fetchrow(char *);
 
93
SV                 *plperl_spi_prepare(char *, int, SV **);
 
94
HV                 *plperl_spi_exec_prepared(char *, HV *, int, SV **);
 
95
SV                 *plperl_spi_query_prepared(char *, int, SV **);
 
96
void            plperl_spi_freeplan(char *);
 
97
void            plperl_spi_cursor_close(char *);
 
98
char       *plperl_sv_to_literal(SV *, char *);
 
99
 
 
100
 
 
101
 
 
102
#endif   /* PL_PERL_H */