summaryrefslogtreecommitdiff
path: root/contrib/tsearch2/tsvector.h
diff options
context:
space:
mode:
authorBruce Momjian2005-05-25 21:40:43 +0000
committerBruce Momjian2005-05-25 21:40:43 +0000
commitb492c3acccb3f8c97559ddfc2a25f25953a026d2 (patch)
treea9c42aa2bd86a88a849ffaa005766ffe3dee762a /contrib/tsearch2/tsvector.h
parent13b729ca5267b58005f1ca9c873a86c2b0db3591 (diff)
Add parentheses to macros when args are used in computations. Without
them, the executation behavior could be unexpected.
Diffstat (limited to 'contrib/tsearch2/tsvector.h')
-rw-r--r--contrib/tsearch2/tsvector.h12
1 files changed, 6 insertions, 6 deletions
diff --git a/contrib/tsearch2/tsvector.h b/contrib/tsearch2/tsvector.h
index 358ec570b69..e2fd0b6faef 100644
--- a/contrib/tsearch2/tsvector.h
+++ b/contrib/tsearch2/tsvector.h
@@ -37,7 +37,7 @@ typedef struct
typedef uint16 WordEntryPos;
#define WEP_GETWEIGHT(x) ( (x) >> 14 )
-#define WEP_GETPOS(x) ( (x) & 0x3fff )
+#define WEP_GETPOS(x) ( (x) & 0x3fff )
#define WEP_SETWEIGHT(x,v) (x) = ( (v) << 14 ) | ( (x) & 0x3fff )
#define WEP_SETPOS(x,v) (x) = ( (x) & 0xc000 ) | ( (v) & 0x3fff )
@@ -54,11 +54,11 @@ typedef struct
char data[1];
} tsvector;
-#define DATAHDRSIZE (sizeof(int4)*2)
-#define CALCDATASIZE(x, lenstr) ( x * sizeof(WordEntry) + DATAHDRSIZE + lenstr )
-#define ARRPTR(x) ( (WordEntry*) ( (char*)x + DATAHDRSIZE ) )
-#define STRPTR(x) ( (char*)x + DATAHDRSIZE + ( sizeof(WordEntry) * ((tsvector*)x)->size ) )
-#define STRSIZE(x) ( ((tsvector*)x)->len - DATAHDRSIZE - ( sizeof(WordEntry) * ((tsvector*)x)->size ) )
+#define DATAHDRSIZE (sizeof(int4) * 2)
+#define CALCDATASIZE(x, lenstr) ( (x) * sizeof(WordEntry) + DATAHDRSIZE + (lenstr) )
+#define ARRPTR(x) ( (WordEntry*) ( (char*)(x) + DATAHDRSIZE ) )
+#define STRPTR(x) ( (char*)(x) + DATAHDRSIZE + ( sizeof(WordEntry) * ((tsvector*)(x))->size ) )
+#define STRSIZE(x) ( ((tsvector*)(x))->len - DATAHDRSIZE - ( sizeof(WordEntry) * ((tsvector*)(x))->size ) )
#define _POSDATAPTR(x,e) (STRPTR(x)+((WordEntry*)(e))->pos+SHORTALIGN(((WordEntry*)(e))->len))
#define POSDATALEN(x,e) ( ( ((WordEntry*)(e))->haspos ) ? (*(uint16*)_POSDATAPTR(x,e)) : 0 )
#define POSDATAPTR(x,e) ( (WordEntryPos*)( _POSDATAPTR(x,e)+sizeof(uint16) ) )