]> granicus.if.org Git - postgis/commitdiff
bug fixed in lwgeom_mem_size
authorSandro Santilli <strk@keybit.net>
Fri, 20 Aug 2004 09:31:32 +0000 (09:31 +0000)
committerSandro Santilli <strk@keybit.net>
Fri, 20 Aug 2004 09:31:32 +0000 (09:31 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@706 b70326c6-7e19-0410-871a-916f4a2858ee

lwgeom/lwgeom_functions_basic.c

index 8c2efa5c1928c305db82e2eab9e47b7f1bfedabd..e8e7f650e1efe0c4ef1eaa13b5ef1f0305db5425 100644 (file)
@@ -193,7 +193,9 @@ Datum combine_box2d(PG_FUNCTION_ARGS)
 PG_FUNCTION_INFO_V1(lwgeom_mem_size);
 Datum lwgeom_mem_size(PG_FUNCTION_ARGS)
 {
-       //char *geom = (char *)  PG_DETOAST_DATUM(PG_GETARG_DATUM(0));
-       //struct varlena *vl = (struct varlena *)(PG_GETARG_POINTER(0));
-       PG_RETURN_INT32(VARSIZE(PG_GETARG_POINTER(0)));
+       char *geom = (char *)  PG_DETOAST_DATUM(PG_GETARG_DATUM(0));
+       int size = *((int *)geom);
+       PG_FREE_IF_COPY(geom,0);
+       int32 vlsize = VARSIZE(PG_GETARG_POINTER(0));
+       PG_RETURN_INT32(size);
 }