forked from pgbouncer/pgbouncer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
postgres_compat.h
36 lines (27 loc) · 973 Bytes
/
postgres_compat.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/*
* Various things to allow source files from postgresql code to be
* used in pgbouncer. pgbouncer's system.h needs to be included
* before this.
*/
/* from c.h */
#include <string.h>
#include <usual/ctype.h>
#define int8 int8_t
#define uint8 uint8_t
#define uint16 uint16_t
#define uint32 uint32_t
#define lengthof(array) (sizeof (array) / sizeof ((array)[0]))
#define pg_hton32(x) htobe32(x)
#define pg_strncasecmp strncasecmp
#define pg_attribute_noreturn() _NORETURN
#define HIGHBIT (0x80)
#define IS_HIGHBIT_SET(ch) ((unsigned char)(ch) & HIGHBIT)
/* sha2.h compat */
#define pg_sha256_ctx struct sha256_ctx
#define PG_SHA256_BLOCK_LENGTH SHA256_BLOCK_SIZE
#define PG_SHA256_DIGEST_LENGTH SHA256_DIGEST_LENGTH
#define pg_sha256_init(ctx) sha256_reset(ctx)
#define pg_sha256_update(ctx, data, len) sha256_update(ctx, data, len)
#define pg_sha256_final(ctx, dst) sha256_final(ctx, dst)
/* define this to use non-server code paths */
#define FRONTEND