summaryrefslogtreecommitdiff
path: root/contrib/tsearch/txtidx.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/tsearch/txtidx.c')
-rw-r--r--contrib/tsearch/txtidx.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/contrib/tsearch/txtidx.c b/contrib/tsearch/txtidx.c
index 39a64437c5f..e1abd54d3bd 100644
--- a/contrib/tsearch/txtidx.c
+++ b/contrib/tsearch/txtidx.c
@@ -88,12 +88,16 @@ uniqueentry( WordEntry* a, int4 l, char *buf, int4 *outbuflen ) {
#define WAITNEXTCHAR 3
#define WAITENDCMPLX 4
-#define RESIZEPRSBUF if ( state->curpos - state->word == state->len ) { \
+#define RESIZEPRSBUF \
+do { \
+ if ( state->curpos - state->word == state->len ) \
+ { \
int4 clen = state->curpos - state->word; \
state->len *= 2; \
state->word = (char*)repalloc( (void*)state->word, state->len ); \
state->curpos = state->word + clen; \
-}
+ } \
+} while (0)
int4
gettoken_txtidx( TI_IN_STATE *state ) {