@@ -85,26 +85,22 @@ typedef uint16 WordEntryPos;
8585/* This struct represents a complete tsvector2 datum */
8686typedef struct
8787{
88- int32 vl_len_ ; /* varlena header (do not touch directly!) */
89- int32 size_ ; /* flags and lexemes count */
88+ int32 vl_len ; /* varlena header (do not touch directly!) */
89+ int32 size ; /* flags and lexemes count */
9090 WordEntry2 entries [FLEXIBLE_ARRAY_MEMBER ];
9191 /* lexemes follow the entries[] array */
9292} TSVectorData2 ;
9393
9494typedef TSVectorData2 * TSVector2 ;
9595
96- #define TS_FLAG_STRETCHED 0x80000000
97- #define TS_COUNT (t ) ((t)->size_ & 0x0FFFFFFF)
98- #define TS_SETCOUNT (t ,c ) ((t)->size_ = (c) | TS_FLAG_STRETCHED)
99-
10096#define DATAHDRSIZE (offsetof(TSVectorData2, entries))
10197#define CALCDATASIZE (nentries , lenstr ) (DATAHDRSIZE + (nentries) * sizeof(WordEntry2) + (lenstr) )
10298
10399/* pointer to start of a tsvector2's WordEntry2 array */
104100#define tsvector2_entries (x ) ( (x)->entries )
105101
106102/* pointer to start of a tsvector2's lexeme storage */
107- #define tsvector2_storage (x ) ( (char *) &(x)->entries[TS_COUNT(x) ] )
103+ #define tsvector2_storage (x ) ( (char *) &(x)->entries[x->size ] )
108104
109105/* for WordEntry2 with offset return its WordEntry2 with other properties */
110106#define UNWRAP_ENTRY (x ,we ) \
@@ -118,7 +114,7 @@ typedef TSVectorData2 *TSVector2;
118114#define ENTRY_LEN (x ,we ) (UNWRAP_ENTRY(x,we)->len)
119115
120116/* pointer to start of positions */
121- #define POSDATAPTR (lex , len ) ((WordEntryPos *) (lex + SHORTALIGN(len)))
117+ #define get_lexeme_positions (lex , len ) ((WordEntryPos *) (lex + SHORTALIGN(len)))
122118
123119/* set default offset in tsvector2 data */
124120#define INITPOS (p ) ((p) = sizeof(WordEntry2))
@@ -135,7 +131,7 @@ do { \
135131 (w)++; \
136132 Assert(!y->hasoff); \
137133 (p) += SHORTALIGN(y->len) + y->npos * sizeof(WordEntryPos); \
138- if ((w) - ARRPTR(x) < TS_COUNT(x) && w->hasoff) \
134+ if ((w) - ARRPTR(x) < x->size && w->hasoff) \
139135 (p) = INTALIGN(p) + sizeof(WordEntry2); \
140136} while (0);
141137
@@ -288,7 +284,7 @@ char *tsvector2_addlexeme(TSVector2 tsv, int idx, int *dataoff,
288284inline static char *
289285tsvector2_getlexeme (TSVector2 vec , int idx , WordEntry2 * * we )
290286{
291- Assert (idx >= 0 && idx < TS_COUNT ( vec ) );
287+ Assert (idx >= 0 && idx < vec -> size );
292288
293289 /*
294290 * we do not allow we == NULL because returned lexeme is not \0 ended, and
0 commit comments