mirror of
https://github.com/postgres/postgres.git
synced 2025-04-25 21:42:33 +03:00
Fix Windows build broken in 6943a946c7e5eb72d53c0ce71f08a81a133503bd
Also it fixes dynamic array allocation disallowed by ANSI-C. Author: Stas Kelvich
This commit is contained in:
parent
8829af47ef
commit
b1fdc727c3
@ -66,7 +66,7 @@ typedef struct
|
||||
#define STATHDRSIZE (offsetof(TSVectorStat, data))
|
||||
|
||||
static Datum tsvector_update_trigger(PG_FUNCTION_ARGS, bool config_column);
|
||||
static int tsvector_bsearch(TSVector tsin, char *lexin, int lexin_len);
|
||||
static int tsvector_bsearch(const TSVector tsv, char *lexeme, int lexeme_len);
|
||||
|
||||
/*
|
||||
* Order: haspos, len, word, for all positions (pos, weight)
|
||||
@ -684,10 +684,12 @@ tsvector_to_array(PG_FUNCTION_ARGS)
|
||||
{
|
||||
TSVector tsin = PG_GETARG_TSVECTOR(0);
|
||||
WordEntry *arrin = ARRPTR(tsin);
|
||||
Datum elements[tsin->size];
|
||||
Datum *elements;
|
||||
int i;
|
||||
ArrayType *array;
|
||||
|
||||
elements = palloc(tsin->size * sizeof(Datum));
|
||||
|
||||
for (i = 0; i < tsin->size; i++)
|
||||
{
|
||||
elements[i] = PointerGetDatum(
|
||||
@ -696,6 +698,8 @@ tsvector_to_array(PG_FUNCTION_ARGS)
|
||||
}
|
||||
|
||||
array = construct_array(elements, tsin->size, TEXTOID, -1, false, 'i');
|
||||
|
||||
pfree(elements);
|
||||
PG_FREE_IF_COPY(tsin, 0);
|
||||
PG_RETURN_POINTER(array);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user