Content-Length: 301436 | pFad | http://github.com/postgrespro/postgres/commit/b1fdc727c37b23da947b4b0d440f723f31beb84d

B6 Fix Windows build broken in 6943a946c7e5eb72d53c0ce71f08a81a133503bd · postgrespro/postgres@b1fdc72 · GitHub
Skip to content

Commit b1fdc72

Browse files
committed
Fix Windows build broken in 6943a94
Also it fixes dynamic array allocation disallowed by ANSI-C. Author: Stas Kelvich
1 parent 8829af4 commit b1fdc72

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/backend/utils/adt/tsvector_op.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ typedef struct
6666
#define STATHDRSIZE (offsetof(TSVectorStat, data))
6767

6868
static Datum tsvector_update_trigger(PG_FUNCTION_ARGS, bool config_column);
69-
static int tsvector_bsearch(TSVector tsin, char *lexin, int lexin_len);
69+
static int tsvector_bsearch(const TSVector tsv, char *lexeme, int lexeme_len);
7070

7171
/*
7272
* Order: haspos, len, word, for all positions (pos, weight)
@@ -684,10 +684,12 @@ tsvector_to_array(PG_FUNCTION_ARGS)
684684
{
685685
TSVector tsin = PG_GETARG_TSVECTOR(0);
686686
WordEntry *arrin = ARRPTR(tsin);
687-
Datum elements[tsin->size];
687+
Datum *elements;
688688
int i;
689689
ArrayType *array;
690690

691+
elements = palloc(tsin->size * sizeof(Datum));
692+
691693
for (i = 0; i < tsin->size; i++)
692694
{
693695
elements[i] = PointerGetDatum(
@@ -696,6 +698,8 @@ tsvector_to_array(PG_FUNCTION_ARGS)
696698
}
697699

698700
array = construct_array(elements, tsin->size, TEXTOID, -1, false, 'i');
701+
702+
pfree(elements);
699703
PG_FREE_IF_COPY(tsin, 0);
700704
PG_RETURN_POINTER(array);
701705
}

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/postgrespro/postgres/commit/b1fdc727c37b23da947b4b0d440f723f31beb84d

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy