Changeset: 5a223a7577b6 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/5a223a7577b6
Modified Files:
        sql/server/rel_psm.c
Branch: ustr
Log Message:

Merge with default branch.


diffs (104 lines):

diff --git a/gdk/gdk_utils.c b/gdk/gdk_utils.c
--- a/gdk/gdk_utils.c
+++ b/gdk/gdk_utils.c
@@ -2170,6 +2170,9 @@ ma_reset(allocator *sa)
        sa->size = MA_NUM_BLOCKS;
        sa->blks[0] = sa->first_blk;
        sa->used = offset;
+#if !defined(NDEBUG) && !defined(SANITIZER)
+       DEADBEEFCHK memset((char *) sa->blks[0] + offset, '\xDB', MA_BLOCK_SIZE 
- offset);
+#endif
 #ifndef NDEBUG
        sa->frees = 0;
 #endif
@@ -2232,6 +2235,9 @@ ma_fill_in_header(void *r, size_t sz)
                // store canary value to help us detect double free
                rs[1] = CANARY_VALUE;
                r = &rs[2];
+#if !defined(NDEBUG) && !defined(SANITIZER)
+               DEADBEEFCHK memset(r, '\xBD', sz);
+#endif
        }
        return r;
 }
diff --git a/geom/lib/libgeom.h b/geom/lib/libgeom.h
--- a/geom/lib/libgeom.h
+++ b/geom/lib/libgeom.h
@@ -129,7 +129,7 @@ typedef struct {
 
 libgeom_export gdk_return libgeom_init(void);
 
-#define mbr_nil mbrFromGeos(NULL);
+#define mbr_nil mbrFromGeos(NULL, NULL);
 
 libgeom_export bool is_wkb_nil(const wkb *wkbp);
 libgeom_export GEOSGeom wkb2geos(const wkb *geomWKB);
diff --git a/geom/monetdb5/geom.c b/geom/monetdb5/geom.c
--- a/geom/monetdb5/geom.c
+++ b/geom/monetdb5/geom.c
@@ -2396,10 +2396,9 @@ geos2wkb(allocator *ma, wkb **geomWKB, s
 
 /* gets the mbr from the geometry */
 mbr *
-mbrFromGeos(const GEOSGeom geosGeometry)
-{
-       allocator *ma = MT_thread_getallocator();
-       assert(ma);
+mbrFromGeos(allocator *ma, const GEOSGeom geosGeometry)
+{
+       assert(ma != NULL || geosGeometry == NULL);
        GEOSGeom envelope;
        mbr *geomMBR;
        double xmin = 0, ymin = 0, xmax = 0, ymax = 0;
diff --git a/geom/monetdb5/geom.h b/geom/monetdb5/geom.h
--- a/geom/monetdb5/geom.h
+++ b/geom/monetdb5/geom.h
@@ -48,7 +48,7 @@ extern str wkbFromWKB(Client ctx, wkb **
 
 /* gets a GEOSGeometry and returns the mbr of it
  * works only for 2D geometries */
-extern mbr* mbrFromGeos(const GEOSGeom geosGeometry)
+extern mbr* mbrFromGeos(allocator *ma, const GEOSGeom geosGeometry)
        __attribute__((__visibility__("hidden")));
 
 
diff --git a/geom/monetdb5/geomBulk.c b/geom/monetdb5/geomBulk.c
--- a/geom/monetdb5/geomBulk.c
+++ b/geom/monetdb5/geomBulk.c
@@ -532,7 +532,7 @@ filterJoinRTree(bat *lres_id, bat *rres_
                        continue;
 
                //Calculate the MBR for the constant geometry
-               mbr *outer_mbr = mbrFromGeos(outer_geom);
+               mbr *outer_mbr = mbrFromGeos(ta, outer_geom);
                BUN* results_rtree = RTREEsearch(ta, inner_b, outer_mbr, 
outer_ci.ncand);
                if (results_rtree == NULL) {
                        msg = createException(MAL, name, "RTreesearch failed, 
returned NULL candidates");
diff --git a/geom/monetdb5/geom_atoms.c b/geom/monetdb5/geom_atoms.c
--- a/geom/monetdb5/geom_atoms.c
+++ b/geom/monetdb5/geom_atoms.c
@@ -653,7 +653,7 @@ wkbMBR(Client ctx, mbr **geomMBR, wkb **
                throw(MAL, "geom.MBR", SQLSTATE(38000) "Geos problem converting 
GEOS to WKB");
        }
 
-       *geomMBR = mbrFromGeos(geosGeometry);
+       *geomMBR = mbrFromGeos(ma, geosGeometry);
 
        GEOSGeom_destroy_r(geoshandle, geosGeometry);
 
diff --git a/monetdb5/modules/atoms/inet.c b/monetdb5/modules/atoms/inet.c
--- a/monetdb5/modules/atoms/inet.c
+++ b/monetdb5/modules/atoms/inet.c
@@ -561,10 +561,10 @@ INEThost(Client ctx, str *retval, const 
        if (is_inet_nil(val)) {
                *retval = (char *) str_nil;
        } else {
-               ip = ma_alloc(ma, sizeof(char) * 16);
+               ip = ma_alloc(ma, 16);
                if (ip == NULL)
                        throw(MAL, "INEThost", SQLSTATE(HY013) MAL_MALLOC_FAIL);
-               sprintf(ip, "%d.%d.%d.%d", val->q1, val->q2, val->q3, val->q4);
+               snprintf(ip, 16, "%d.%d.%d.%d", val->q1, val->q2, val->q3, 
val->q4);
                *retval = ip;
        }
        return (MAL_SUCCEED);
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to