* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/gin/ginbulk.c,v 1.11 2008/01/01 19:45:46 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/access/gin/ginbulk.c,v 1.12 2008/06/29 21:04:01 tgl Exp $
*-------------------------------------------------------------------------
*/
}
/*
- * This is basically the same as datumCopy(), but we duplicate some code
- * to avoid computing the datum size twice.
+ * This is basically the same as datumCopy(), but modified to count
+ * palloc'd space in accum.
*/
static Datum
getDatumCopy(BuildAccumulator *accum, Datum value)
res = value;
else
{
- Size realSize;
- char *s;
-
- realSize = datumGetSize(value, false, att[0]->attlen);
-
- s = (char *) palloc(realSize);
- accum->allocatedMemory += GetMemoryChunkSpace(s);
-
- memcpy(s, DatumGetPointer(value), realSize);
- res = PointerGetDatum(s);
+ res = datumCopy(value, false, att[0]->attlen);
+ accum->allocatedMemory += GetMemoryChunkSpace(DatumGetPointer(res));
}
return res;
}