1
0
mirror of https://github.com/postgres/postgres.git synced 2025-08-21 10:42:50 +03:00

Fix statically allocated struct with FLEXIBLE_ARRAY_MEMBER member.

clang complains about this, not unreasonably, so define another struct
that's explicitly for a WordEntryPos with exactly one element.

While at it, get rid of pretty dubious use of a static variable for
more than one purpose --- if it were being treated as const maybe
I'd be okay with this, but it isn't.
This commit is contained in:
Tom Lane
2015-02-20 17:50:18 -05:00
parent 33a3b03d63
commit 33b2a2c97f
2 changed files with 24 additions and 11 deletions

View File

@@ -66,6 +66,13 @@ typedef struct
WordEntryPos pos[FLEXIBLE_ARRAY_MEMBER];
} WordEntryPosVector;
/* WordEntryPosVector with exactly 1 entry */
typedef struct
{
uint16 npos;
WordEntryPos pos[1];
} WordEntryPosVector1;
#define WEP_GETWEIGHT(x) ( (x) >> 14 )
#define WEP_GETPOS(x) ( (x) & 0x3fff )