summaryrefslogtreecommitdiff
path: root/src/backend/access/gin/ginbulk.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2008-06-29 21:04:01 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2008-06-29 21:04:01 +0000
commit7ea9b997ef07672d45278ab1c5b0634eaa090966 (patch)
tree91d508cf576ad1a7e8931910d7be1d7b04eb518b /src/backend/access/gin/ginbulk.c
parent4a8d573cda5cacf30da61e14aaeda8bbc3057d9d (diff)
downloadpostgresql-7ea9b997ef07672d45278ab1c5b0634eaa090966.tar.gz
Remove unnecessary coziness of GIN code with datum copying. Now that
space is tracked via GetMemoryChunkSpace, there's really no advantage to duplicating datumCopy's innards here. This is one bit of my toast indirection patch that should go in anyway.
Diffstat (limited to 'src/backend/access/gin/ginbulk.c')
-rw-r--r--src/backend/access/gin/ginbulk.c18
1 files changed, 5 insertions, 13 deletions
diff --git a/src/backend/access/gin/ginbulk.c b/src/backend/access/gin/ginbulk.c
index 2165428c54..b17e87cdb1 100644
--- a/src/backend/access/gin/ginbulk.c
+++ b/src/backend/access/gin/ginbulk.c
@@ -8,7 +8,7 @@
* 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 $
*-------------------------------------------------------------------------
*/
@@ -78,8 +78,8 @@ ginInsertData(BuildAccumulator *accum, EntryAccumulator *entry, ItemPointer heap
}
/*
- * 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)
@@ -91,16 +91,8 @@ 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;
}