Changeset: 4a454180805f for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=4a454180805f
Modified Files:
        gdk/gdk_aggr.c
        gdk/gdk_align.c
        gdk/gdk_batop.c
        gdk/gdk_cross.c
        gdk/gdk_join.c
        monetdb5/modules/atoms/batxml.c
        monetdb5/modules/atoms/json.c
        monetdb5/modules/mal/bbp.c
        monetdb5/modules/mal/mat.c
        monetdb5/modules/mal/txtsim.c
Branch: default
Log Message:

No need to check that BBPreclaim arg is non-NULL: BBPreclaim does that.


diffs (300 lines):

diff --git a/gdk/gdk_aggr.c b/gdk/gdk_aggr.c
--- a/gdk/gdk_aggr.c
+++ b/gdk/gdk_aggr.c
@@ -1586,8 +1586,7 @@ BATgroupavg(BAT **bnp, BAT **cntsp, BAT 
                BBPunfix(bn->batCacheid);
        GDKfree(rems);
        if (cntsp) {
-               if (*cntsp)
-                       BBPreclaim(*cntsp);
+               BBPreclaim(*cntsp);
        } else if (cnts) {
                GDKfree(cnts);
        }
@@ -2947,8 +2946,7 @@ dogroupstdev(BAT **avgb, BAT *b, BAT *g,
                BBPreclaim(*avgb);
        else
                GDKfree(mean);
-       if (bn)
-               BBPreclaim(bn);
+       BBPreclaim(bn);
        GDKfree(delta);
        GDKfree(m2);
        GDKfree(cnts);
diff --git a/gdk/gdk_align.c b/gdk/gdk_align.c
--- a/gdk/gdk_align.c
+++ b/gdk/gdk_align.c
@@ -724,8 +724,7 @@ VIEWreset(BAT *b)
        }
        return GDK_SUCCEED;
       bailout:
-       if (v != NULL)
-               BBPreclaim(v);
+       BBPreclaim(v);
        if (n != NULL)
                BBPunfix(n->batCacheid);
        HEAPfree(&head, 0);
diff --git a/gdk/gdk_batop.c b/gdk/gdk_batop.c
--- a/gdk/gdk_batop.c
+++ b/gdk/gdk_batop.c
@@ -611,8 +611,7 @@ BATins(BAT *b, BAT *n, bit force)
        }
        res = GDK_SUCCEED;
       bunins_failed:
-       if (tmp)
-               BBPreclaim(tmp);
+       BBPreclaim(tmp);
        return res;
 }
 
@@ -1497,8 +1496,7 @@ BATsubsort(BAT **sorted, BAT **order, BA
   error:
        if (bn)
                BBPunfix(bn->batCacheid);
-       if (on)
-               BBPreclaim(on);
+       BBPreclaim(on);
        if (sorted)
                *sorted = NULL;
        if (order)
diff --git a/gdk/gdk_cross.c b/gdk/gdk_cross.c
--- a/gdk/gdk_cross.c
+++ b/gdk/gdk_cross.c
@@ -22,10 +22,8 @@ BATcross1(BAT **r1p, BAT **r2p, BAT *l, 
        bn1 = BATnew(TYPE_void, TYPE_oid, BATcount(l) * BATcount(r), TRANSIENT);
        bn2 = BATnew(TYPE_void, TYPE_oid, BATcount(l) * BATcount(r), TRANSIENT);
        if (bn1 == NULL || bn2 == NULL) {
-               if (bn1 != NULL)
-                       BBPreclaim(bn1);
-               if (bn2 != NULL)
-                       BBPreclaim(bn2);
+               BBPreclaim(bn1);
+               BBPreclaim(bn2);
                return GDK_FAIL;
        }
        BATseqbase(bn1, 0);
diff --git a/gdk/gdk_join.c b/gdk/gdk_join.c
--- a/gdk/gdk_join.c
+++ b/gdk/gdk_join.c
@@ -116,10 +116,8 @@ joininitresults(BAT **r1p, BAT **r2p, BU
        r1 = BATnew(TYPE_void, TYPE_oid, size, TRANSIENT);
        r2 = BATnew(TYPE_void, TYPE_oid, size, TRANSIENT);
        if (r1 == NULL || r2 == NULL) {
-               if (r1)
-                       BBPreclaim(r1);
-               if (r2)
-                       BBPreclaim(r2);
+               BBPreclaim(r1);
+               BBPreclaim(r2);
                *r1p = *r2p = NULL;
                GDKerror("%s: cannot create output BATs.\n", func);
                return GDK_FAIL;
@@ -2078,10 +2076,8 @@ hashjoin(BAT *r1, BAT *r2, BAT *l, BAT *
        return GDK_SUCCEED;
 
   bailout:
-       if (r1)
-               BBPreclaim(r1);
-       if (r2)
-               BBPreclaim(r2);
+       BBPreclaim(r1);
+       BBPreclaim(r2);
        return GDK_FAIL;
 }
 
@@ -2310,10 +2306,8 @@ thetajoin(BAT *r1, BAT *r2, BAT *l, BAT 
        return GDK_SUCCEED;
 
   bailout:
-       if (r1)
-               BBPreclaim(r1);
-       if (r2)
-               BBPreclaim(r2);
+       BBPreclaim(r1);
+       BBPreclaim(r2);
        return GDK_FAIL;
 }
 
@@ -2713,10 +2707,8 @@ bandjoin(BAT *r1, BAT *r2, BAT *l, BAT *
        return GDK_SUCCEED;
 
   bailout:
-       if (r1)
-               BBPreclaim(r1);
-       if (r2)
-               BBPreclaim(r2);
+       BBPreclaim(r1);
+       BBPreclaim(r2);
        return GDK_FAIL;
 }
 
diff --git a/monetdb5/modules/atoms/batxml.c b/monetdb5/modules/atoms/batxml.c
--- a/monetdb5/modules/atoms/batxml.c
+++ b/monetdb5/modules/atoms/batxml.c
@@ -1638,8 +1638,7 @@ BATxmlaggr(BAT **bnp, BAT *b, BAT *g, BA
        return err;
 
   bunins_failed:
-       if (bn)
-               BBPreclaim(bn);
+       BBPreclaim(bn);
        bn = NULL;
        if (err == NULL)
                err = MAL_MALLOC_FAIL;  /* insertion into result BAT failed */
diff --git a/monetdb5/modules/atoms/json.c b/monetdb5/modules/atoms/json.c
--- a/monetdb5/modules/atoms/json.c
+++ b/monetdb5/modules/atoms/json.c
@@ -2120,8 +2120,7 @@ JSONjsonaggr(BAT **bnp, BAT *b, BAT *g, 
        return err;
 
       bunins_failed:
-       if (bn)
-               BBPreclaim(bn);
+       BBPreclaim(bn);
        bn = NULL;
        if (err == NULL)
                err = MAL_MALLOC_FAIL;  /* insertion into result BAT failed */
diff --git a/monetdb5/modules/mal/bbp.c b/monetdb5/modules/mal/bbp.c
--- a/monetdb5/modules/mal/bbp.c
+++ b/monetdb5/modules/mal/bbp.c
@@ -411,30 +411,18 @@ str CMDbbp(bat *ID, bat *NS, bat *HT, ba
        kind = BATnew(TYPE_void, TYPE_str, getBBPsize(), TRANSIENT);
 
        if (!id || !ns || !ht || !tt || !cnt || !refcnt || !lrefcnt || 
!location || !heat || !dirty || !status || !kind) {
-               if (id)
-                       BBPreclaim(id);
-               if (ns)
-                       BBPreclaim(ns);
-               if (ht)
-                       BBPreclaim(ht);
-               if (tt)
-                       BBPreclaim(tt);
-               if (cnt)
-                       BBPreclaim(cnt);
-               if (refcnt)
-                       BBPreclaim(refcnt);
-               if (lrefcnt)
-                       BBPreclaim(lrefcnt);
-               if (location)
-                       BBPreclaim(location);
-               if (heat)
-                       BBPreclaim(heat);
-               if (dirty)
-                       BBPreclaim(dirty);
-               if (status)
-                       BBPreclaim(status);
-               if (kind)
-                       BBPreclaim(kind);
+               BBPreclaim(id);
+               BBPreclaim(ns);
+               BBPreclaim(ht);
+               BBPreclaim(tt);
+               BBPreclaim(cnt);
+               BBPreclaim(refcnt);
+               BBPreclaim(lrefcnt);
+               BBPreclaim(location);
+               BBPreclaim(heat);
+               BBPreclaim(dirty);
+               BBPreclaim(status);
+               BBPreclaim(kind);
                throw(MAL, "catalog.bbp", MAL_MALLOC_FAIL);
        }
        BATseqbase(id, 0);
diff --git a/monetdb5/modules/mal/mat.c b/monetdb5/modules/mal/mat.c
--- a/monetdb5/modules/mal/mat.c
+++ b/monetdb5/modules/mal/mat.c
@@ -544,12 +544,9 @@ MATproject_any( BAT *map, BAT **bats, in
        batsT = (BUN*)GDKmalloc(sizeof(BUN) * len);
        bats_i = (BATiter*)GDKmalloc(sizeof(BATiter) * len);
        if (res == NULL || batsT == NULL || bats_i == NULL) {
-               if (res)
-                       BBPreclaim(res);
-               if (batsT)
-                       GDKfree(batsT);
-               if (bats_i)
-                       GDKfree(bats_i);
+               BBPreclaim(res);
+               GDKfree(batsT);
+               GDKfree(bats_i);
                return NULL;
        }
        BATseqbase(res, map->hseqbase);
@@ -578,10 +575,8 @@ MATproject_bte( BAT *map, BAT **bats, in
        res = BATnew(TYPE_void, ttpe, cnt, TRANSIENT);
        batsT = (bte**)GDKmalloc(sizeof(bte*) * len);
        if (res == NULL || batsT == NULL) {
-               if (res)
-                       BBPreclaim(res);
-               if (batsT)
-                       GDKfree(batsT);
+               BBPreclaim(res);
+               GDKfree(batsT);
                return NULL;
        }
        BATseqbase(res, map->hseqbase);
@@ -609,10 +604,8 @@ MATproject_sht( BAT *map, BAT **bats, in
        res = BATnew(TYPE_void, ttpe, cnt, TRANSIENT);
        batsT = (sht**)GDKmalloc(sizeof(sht*) * len);
        if (res == NULL || batsT == NULL) {
-               if (res)
-                       BBPreclaim(res);
-               if (batsT)
-                       GDKfree(batsT);
+               BBPreclaim(res);
+               GDKfree(batsT);
                return NULL;
        }
        BATseqbase(res, map->hseqbase);
@@ -640,10 +633,8 @@ MATproject_int( BAT *map, BAT **bats, in
        res = BATnew(TYPE_void, ttpe, cnt, TRANSIENT);
        batsT = (int**)GDKmalloc(sizeof(int*) * len);
        if (res == NULL || batsT == NULL) {
-               if (res)
-                       BBPreclaim(res);
-               if (batsT)
-                       GDKfree(batsT);
+               BBPreclaim(res);
+               GDKfree(batsT);
                return NULL;
        }
        BATseqbase(res, map->hseqbase);
@@ -671,10 +662,8 @@ MATproject_lng( BAT *map, BAT **bats, in
        res = BATnew(TYPE_void, ttpe, cnt, TRANSIENT);
        batsT = (lng**)GDKmalloc(sizeof(lng*) * len);
        if (res == NULL || batsT == NULL) {
-               if (res)
-                       BBPreclaim(res);
-               if (batsT)
-                       GDKfree(batsT);
+               BBPreclaim(res);
+               GDKfree(batsT);
                return NULL;
        }
        BATseqbase(res, map->hseqbase);
@@ -703,10 +692,8 @@ MATproject_hge( BAT *map, BAT **bats, in
        res = BATnew(TYPE_void, ttpe, cnt, TRANSIENT);
        batsT = (hge**)GDKmalloc(sizeof(hge*) * len);
        if (res == NULL || batsT == NULL) {
-               if (res)
-                       BBPreclaim(res);
-               if (batsT)
-                       GDKfree(batsT);
+               BBPreclaim(res);
+               GDKfree(batsT);
                return NULL;
        }
        BATseqbase(res, map->hseqbase);
diff --git a/monetdb5/modules/mal/txtsim.c b/monetdb5/modules/mal/txtsim.c
--- a/monetdb5/modules/mal/txtsim.c
+++ b/monetdb5/modules/mal/txtsim.c
@@ -950,8 +950,8 @@ CMDqgramselfjoin(bat *res1, bat *res2, b
        bn = BATnew(TYPE_void, TYPE_int, n, TRANSIENT);
        bn2 = BATnew(TYPE_void, TYPE_int, n, TRANSIENT);
        if (bn == NULL || bn2 == NULL){
-               if (bn) BBPreclaim(bn);
-               if (bn2) BBPreclaim(bn2);
+               BBPreclaim(bn);
+               BBPreclaim(bn2);
                BBPunfix(qgram->batCacheid);
                BBPunfix(id->batCacheid);
                BBPunfix(pos->batCacheid);
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to