diff options
Diffstat (limited to 'contrib/hstore/hstore.h')
| -rw-r--r-- | contrib/hstore/hstore.h | 57 |
1 files changed, 30 insertions, 27 deletions
diff --git a/contrib/hstore/hstore.h b/contrib/hstore/hstore.h index 5fb5999610..20ae203416 100644 --- a/contrib/hstore/hstore.h +++ b/contrib/hstore/hstore.h @@ -11,39 +11,42 @@ #include "storage/bufpage.h" -typedef struct { - uint16 keylen; - uint16 vallen; - uint32 - valisnull:1, - pos:31; -} HEntry; - - -typedef struct { - int4 len; - int4 size; - char data[1]; -} HStore; +typedef struct +{ + uint16 keylen; + uint16 vallen; + uint32 + valisnull:1, + pos:31; +} HEntry; + + +typedef struct +{ + int4 len; + int4 size; + char data[1]; +} HStore; #define HSHRDSIZE (2*sizeof(int4)) #define CALCDATASIZE(x, lenstr) ( (x) * sizeof(HEntry) + HSHRDSIZE + (lenstr) ) -#define ARRPTR(x) ( (HEntry*) ( (char*)(x) + HSHRDSIZE ) ) -#define STRPTR(x) ( (char*)(x) + HSHRDSIZE + ( sizeof(HEntry) * ((HStore*)x)->size ) ) +#define ARRPTR(x) ( (HEntry*) ( (char*)(x) + HSHRDSIZE ) ) +#define STRPTR(x) ( (char*)(x) + HSHRDSIZE + ( sizeof(HEntry) * ((HStore*)x)->size ) ) -#define PG_GETARG_HS(x) ((HStore*)PG_DETOAST_DATUM(PG_GETARG_DATUM(x))) +#define PG_GETARG_HS(x) ((HStore*)PG_DETOAST_DATUM(PG_GETARG_DATUM(x))) -typedef struct { - char *key; - char *val; - uint16 keylen; - uint16 vallen; - bool isnull; - bool needfree; -} Pairs; +typedef struct +{ + char *key; + char *val; + uint16 keylen; + uint16 vallen; + bool isnull; + bool needfree; +} Pairs; -int comparePairs(const void *a, const void *b); -int uniquePairs(Pairs * a, int4 l, int4 *buflen); +int comparePairs(const void *a, const void *b); +int uniquePairs(Pairs * a, int4 l, int4 *buflen); #endif |
