diff options
Diffstat (limited to 'src/interfaces/ecpg/include/ecpglib.h')
-rw-r--r-- | src/interfaces/ecpg/include/ecpglib.h | 38 |
1 files changed, 24 insertions, 14 deletions
diff --git a/src/interfaces/ecpg/include/ecpglib.h b/src/interfaces/ecpg/include/ecpglib.h index de9c76aefc3..c65073f15ac 100644 --- a/src/interfaces/ecpg/include/ecpglib.h +++ b/src/interfaces/ecpg/include/ecpglib.h @@ -1,6 +1,6 @@ /* - * this is a small part of c.h since we don't want to leak all postgres - * definitions into ecpg programs + * Client-visible declarations for ecpglib + * * src/interfaces/ecpg/include/ecpglib.h */ @@ -8,30 +8,40 @@ #define _ECPGLIB_H #include "libpq-fe.h" +#include "ecpg_config.h" #include "ecpgtype.h" #include "sqlca.h" #include <string.h> +/* + * This is a small extract from c.h since we don't want to leak all postgres + * definitions into ecpg programs; but we need to know what bool is. + */ #ifndef __cplusplus -#ifndef bool -#define bool char -#endif /* ndef bool */ + +#ifdef PG_USE_STDBOOL +#include <stdbool.h> +#else + +/* + * We assume bool has been defined if true and false are. This avoids + * duplicate-typedef errors if this file is included after c.h. + */ +#if !(defined(true) && defined(false)) +typedef unsigned char bool; +#endif #ifndef true #define true ((bool) 1) -#endif /* ndef true */ +#endif + #ifndef false #define false ((bool) 0) -#endif /* ndef false */ -#endif /* not C++ */ +#endif -#ifndef TRUE -#define TRUE 1 -#endif /* TRUE */ +#endif /* not PG_USE_STDBOOL */ +#endif /* not C++ */ -#ifndef FALSE -#define FALSE 0 -#endif /* FALSE */ #ifdef __cplusplus extern "C" |