[postgis-tickets] r15374 - Revert MemoryContext refactor
bjorn at wololo.org
bjorn at wololo.org
Wed Apr 26 13:43:28 PDT 2017
Author: bjornharrtell
Date: 2017-04-26 13:43:28 -0700 (Wed, 26 Apr 2017)
New Revision: 15374
Modified:
trunk/postgis/lwgeom_out_geobuf.c
trunk/postgis/lwgeom_out_mvt.c
Log:
Revert MemoryContext refactor
Modified: trunk/postgis/lwgeom_out_geobuf.c
===================================================================
--- trunk/postgis/lwgeom_out_geobuf.c 2017-04-26 03:39:41 UTC (rev 15373)
+++ trunk/postgis/lwgeom_out_geobuf.c 2017-04-26 20:43:28 UTC (rev 15374)
@@ -49,11 +49,12 @@
lwerror("Missing libprotobuf-c");
PG_RETURN_NULL();
#else
- MemoryContext aggcontext, oldcxt = NULL;
+ MemoryContext aggcontext;
struct geobuf_agg_context *ctx;
if (!AggCheckCallContext(fcinfo, &aggcontext))
- aggcontext = CurrentMemoryContext;
+ lwerror("pgis_asmvt_transfn: called in non-aggregate context");
+ MemoryContextSwitchTo(aggcontext);
if (PG_ARGISNULL(0)) {
ctx = palloc(sizeof(*ctx));
@@ -62,7 +63,6 @@
ctx->geom_name = text_to_cstring(PG_GETARG_TEXT_P(1));
geobuf_agg_init_context(ctx);
} else {
- oldcxt = MemoryContextSwitchTo(aggcontext);
ctx = (struct geobuf_agg_context *) PG_GETARG_POINTER(0);
}
@@ -71,10 +71,6 @@
ctx->row = PG_GETARG_HEAPTUPLEHEADER(2);
geobuf_agg_transfn(ctx);
-
- if (oldcxt)
- MemoryContextSwitchTo(oldcxt);
-
PG_RETURN_POINTER(ctx);
#endif
}
Modified: trunk/postgis/lwgeom_out_mvt.c
===================================================================
--- trunk/postgis/lwgeom_out_mvt.c 2017-04-26 03:39:41 UTC (rev 15373)
+++ trunk/postgis/lwgeom_out_mvt.c 2017-04-26 20:43:28 UTC (rev 15374)
@@ -79,11 +79,12 @@
lwerror("Missing libprotobuf-c");
PG_RETURN_NULL();
#else
- MemoryContext aggcontext, oldcxt = NULL;
+ MemoryContext aggcontext;
struct mvt_agg_context *ctx;
if (!AggCheckCallContext(fcinfo, &aggcontext))
- aggcontext = CurrentMemoryContext;
+ lwerror("pgis_asmvt_transfn: called in non-aggregate context");
+ MemoryContextSwitchTo(aggcontext);
if (PG_ARGISNULL(0)) {
ctx = palloc(sizeof(*ctx));
@@ -100,7 +101,6 @@
PG_FREE_IF_COPY(geom_name, 3);
mvt_agg_init_context(ctx);
} else {
- oldcxt = MemoryContextSwitchTo(aggcontext);
ctx = (struct mvt_agg_context *) PG_GETARG_POINTER(0);
}
@@ -109,11 +109,7 @@
ctx->row = PG_GETARG_HEAPTUPLEHEADER(4);
mvt_agg_transfn(ctx);
-
PG_FREE_IF_COPY(ctx->row, 4);
- if (oldcxt)
- MemoryContextSwitchTo(oldcxt);
-
PG_RETURN_POINTER(ctx);
#endif
}
More information about the postgis-tickets
mailing list