Changeset: d2a8007638c0 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=d2a8007638c0
Modified Files:
        geom/monetdb5/geom.c
        geom/monetdb5/geom.mal
Branch: malparsing
Log Message:

Fix MAL errors and freeException


diffs (122 lines):

diff --git a/geom/monetdb5/geom.c b/geom/monetdb5/geom.c
--- a/geom/monetdb5/geom.c
+++ b/geom/monetdb5/geom.c
@@ -854,18 +854,18 @@ segmentizeLineString(GEOSGeometry **outG
        //store the points so that I do not have to read them multiple times 
using geos
        if ((xCoords_org = GDKmalloc(pointsNum * sizeof(double))) == NULL) {
                *outGeometry = NULL;
-               throw(MAL, "geom.Segmentize", "Could not allocate memory for %d 
double values", pointsNum);
+               throw(MAL, "geom.Segmentize", MAL_MALLOC_FAIL " for %d double 
values", pointsNum);
        }
        if ((yCoords_org = GDKmalloc(pointsNum * sizeof(double))) == NULL) {
                GDKfree(xCoords_org);
                *outGeometry = NULL;
-               throw(MAL, "geom.Segmentize", "Could not allocate memory for %d 
double values", pointsNum);
+               throw(MAL, "geom.Segmentize", MAL_MALLOC_FAIL " for %d double 
values", pointsNum);
        }
        if ((zCoords_org = GDKmalloc(pointsNum * sizeof(double))) == NULL) {
                GDKfree(xCoords_org);
                GDKfree(yCoords_org);
                *outGeometry = NULL;
-               throw(MAL, "geom.Segmentize", "Could not allocate memory for %d 
double values", pointsNum);
+               throw(MAL, "geom.Segmentize", MAL_MALLOC_FAIL " for %d double 
values", pointsNum);
        }
 
        if (!GEOSCoordSeq_getX(gcs_old, 0, &xCoords_org[0])) {
@@ -2236,7 +2236,7 @@ wkbaFROMSTR_withSRID(char *fromStr, int 
                size_t parsedBytes;
                str err = wkbFROMSTR_withSRID(fromStr + skipBytes, len, 
&(*toArray)->data[i], srid, &parsedBytes);
                if (err != MAL_SUCCEED) {
-                       GDKfree(err);
+                       freeException(err);
                        return 0;
                }
                skipBytes += parsedBytes;
@@ -3272,7 +3272,7 @@ wkbMakeLineAggr(wkb **outWKB, bat *inBAT
                err = wkbFromWKB(outWKB, &aWKB);
                BBPunfix(inBAT->batCacheid);
                if (err) {
-                       GDKfree(err);
+                       freeException(err);
                        throw(MAL, "geom.MakeLine", MAL_MALLOC_FAIL);
                }
                return MAL_SUCCEED;
@@ -4223,7 +4223,7 @@ wkbUnionAggr(wkb **outWKB, bat *inBAT_id
                err = wkbFromWKB(outWKB, &aWKB);
                BBPunfix(inBAT->batCacheid);
                if (err) {
-                       GDKfree(err);
+                       freeException(err);
                        throw(MAL, "geom.Union", MAL_MALLOC_FAIL);
                }
                return MAL_SUCCEED;
@@ -5096,7 +5096,7 @@ wkbFROMSTR(char *geomWKT, int *len, wkb 
 
        err = wkbFROMSTR_withSRID(geomWKT, len, geomWKB, 0, &parsedBytes);
        if (err != MAL_SUCCEED) {
-               GDKfree(err);
+               freeException(err);
                return 0;
        }
        return (int) parsedBytes;
diff --git a/geom/monetdb5/geom.mal b/geom/monetdb5/geom.mal
--- a/geom/monetdb5/geom.mal
+++ b/geom/monetdb5/geom.mal
@@ -155,15 +155,17 @@ end GeomCollFromText;
 
 command NumRings(w:wkb, exterior:int) :int address wkbNumRings
 comment "Returns the number of interior rings+exterior on the first polygon of 
the geometry";
-function NumInteriorRings(w:wkb) :int;
-       x := NumRings(w, 0);
-       return x;
-end NumInteriorRings
+
 function NRings(w:wkb) :int;
-       x := NumRings(w, 1);
+       x := geom.NumRings(w, 1);
        return x;
 end NRings;
 
+function NumInteriorRings(w:wkb) :int;
+       x := geom.NumRings(w, 0);
+       return x;
+end NumInteriorRings;
+
 function BdPolyFromText(wkt:str, srid:int) :wkb;
        x := MLineStringToPolygon(wkt,srid,0);
        return x;
@@ -173,9 +175,9 @@ function BdMPolyFromText(wkt:str, srid:i
        return x;
 end BdMPolyFromText;
 
-
 command MakePointXYZM(x:dbl, y:dbl, z:dbl, m:dbl, zmFlag:int) :wkb address 
wkbMakePoint
 comment "creates a point using the coordinates";
+
 function MakePoint(x:dbl, y:dbl) :wkb;
        p := MakePointXYZM(x, y, 0:dbl, 0:dbl, 0);
        return p;
@@ -193,8 +195,6 @@ function MakePoint(x:dbl, y:dbl, z:dbl, 
        return p;
 end MakePoint;
 
-
-
 #command MakePoint(x:dbl, y:dbl) :wkb address geomMakePoint2D
 #comment "creates a point using the coordinates";
 #command MakePoint(x:dbl, y:dbl, z:dbl) :wkb address geomMakePoint3D
@@ -666,11 +666,11 @@ comment "Returns the number of geometrie
 command NumRings(w:bat[:wkb], exterior:int) :bat[:int] address wkbNumRings_bat
 comment "Returns the number of interior rings+exterior on the first polygon of 
the geometry";
 function NumInteriorRings(w:bat[:wkb]) :bat[:int];
-       x := NumRings(w, 0);
+       x := geom.NumRings(w, 0);
        return x;
-end NumInteriorRings
+end NumInteriorRings;
 function NRings(w:bat[:wkb]) :bat[:int];
-       x := NumRings(w, 1);
+       x := geom.NumRings(w, 1);
        return x;
 end NRings;
 
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to