}
/*
- * Auxiliary function to return a text array out of a list of String nodes.
+ * Auxiliary function to build a text array out of a list of String nodes.
*/
static Datum
publicationListToArray(List *publist)
ALLOCSET_DEFAULT_MAXSIZE);
oldcxt = MemoryContextSwitchTo(memcxt);
- datums = palloc(sizeof(text *) * list_length(publist));
+ datums = (Datum *) palloc(sizeof(Datum) * list_length(publist));
+
foreach(cell, publist)
{
char *name = strVal(lfirst(cell));
{
char *pname = strVal(lfirst(pcell));
- if (name == pname)
+ if (pcell == cell)
break;
if (strcmp(name, pname) == 0)
arr = construct_array(datums, list_length(publist),
TEXTOID, -1, false, 'i');
+
MemoryContextDelete(memcxt);
return PointerGetDatum(arr);