]> granicus.if.org Git - postgis/commitdiff
Clear hash tables after usage
authorBjörn Harrtell <bjorn@wololo.org>
Wed, 19 Apr 2017 17:43:18 +0000 (17:43 +0000)
committerBjörn Harrtell <bjorn@wololo.org>
Wed, 19 Apr 2017 17:43:18 +0000 (17:43 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@15354 b70326c6-7e19-0410-871a-916f4a2858ee

postgis/mvt.c
postgis/mvt.h

index 1d5ea594c869d89fa84fd44b594a10980324c3c3..564f61f364b0e36f0e963f011f47e020764d9f74 100644 (file)
@@ -190,7 +190,7 @@ static void encode_mline(struct mvt_agg_context *ctx, LWMLINE *lwmline)
                c += 2 + lwmline->geoms[i]->points->npoints * 2;
        feature->geometry = palloc(sizeof(*feature->geometry) * c);
        for (i = 0; i < lwmline->ngeoms; i++)
-               offset += encode_ptarray(ctx, MVT_LINE, 
+               offset += encode_ptarray(ctx, MVT_LINE,
                        lwmline->geoms[i]->points,
                        feature->geometry + offset, &px, &py);
        feature->n_geometry = offset;
@@ -328,6 +328,13 @@ static void encode_values(struct mvt_agg_context *ctx)
 
        ctx->layer->n_values = ctx->values_hash_i;
        ctx->layer->values = values;
+
+       HASH_CLEAR(hh, ctx->string_values_hash);
+       HASH_CLEAR(hh, ctx->float_values_hash);
+       HASH_CLEAR(hh, ctx->double_values_hash);
+       HASH_CLEAR(hh, ctx->uint_values_hash);
+       HASH_CLEAR(hh, ctx->sint_values_hash);
+       HASH_CLEAR(hh, ctx->bool_values_hash);
 }
 
 #define MVT_PARSE_VALUE(value, kvtype, hash, valuefield, size) \
@@ -463,7 +470,7 @@ static int max_dim(LWCOLLECTION *lwcoll)
  * Makes best effort to keep validity. Might collapse geometry into lower
  * dimension.
  */
-LWGEOM *mvt_geom(LWGEOM *lwgeom, GBOX *gbox, uint32_t extent, uint32_t buffer, 
+LWGEOM *mvt_geom(LWGEOM *lwgeom, GBOX *gbox, uint32_t extent, uint32_t buffer,
        bool clip_geom)
 {
        double width = gbox->xmax - gbox->xmin;
@@ -533,7 +540,7 @@ LWGEOM *mvt_geom(LWGEOM *lwgeom, GBOX *gbox, uint32_t extent, uint32_t buffer,
 /**
  * Initialize aggregation context.
  */
-void mvt_agg_init_context(struct mvt_agg_context *ctx) 
+void mvt_agg_init_context(struct mvt_agg_context *ctx)
 {
        VectorTile__Tile__Layer *layer;
 
@@ -544,7 +551,6 @@ void mvt_agg_init_context(struct mvt_agg_context *ctx)
        ctx->string_values_hash = NULL;
        ctx->float_values_hash = NULL;
        ctx->double_values_hash = NULL;
-       ctx->int_values_hash = NULL;
        ctx->uint_values_hash = NULL;
        ctx->sint_values_hash = NULL;
        ctx->bool_values_hash = NULL;
@@ -628,4 +634,4 @@ uint8_t *mvt_agg_finalfn(struct mvt_agg_context *ctx)
        return buf;
 }
 
-#endif
\ No newline at end of file
+#endif
index b2f87476ae2e5ec76f4f5508d50d43f20c9eedd7..02b3d57a3058b223119b6de8711110f524c21390 100644 (file)
@@ -31,7 +31,7 @@
 #include "utils/array.h"
 #include "utils/typcache.h"
 #include "utils/lsyscache.h"
-#include "catalog/pg_type.h" 
+#include "catalog/pg_type.h"
 #include "executor/executor.h"
 #include "access/htup_details.h"
 #include "access/htup.h"
@@ -57,7 +57,6 @@ struct mvt_agg_context {
        struct mvt_kv_string_value *string_values_hash;
        struct mvt_kv_float_value *float_values_hash;
        struct mvt_kv_double_value *double_values_hash;
-       struct mvt_kv_int_value *int_values_hash;
        struct mvt_kv_uint_value *uint_values_hash;
        struct mvt_kv_sint_value *sint_values_hash;
        struct mvt_kv_bool_value *bool_values_hash;
@@ -72,4 +71,4 @@ uint8_t *mvt_agg_finalfn(struct mvt_agg_context *ctx);
 
 #endif  /* HAVE_LIBPROTOBUF */
 
-#endif
\ No newline at end of file
+#endif