Changeset: 2ad9bb152560 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/2ad9bb152560
Modified Files:
        monetdb5/mal/mal_pipelines.c
        monetdb5/modules/mal/pipeline.c
        monetdb5/modules/mal/pp_hash.c
Branch: pp_hashjoin
Log Message:

Removed unnecessary code, GDKfree already checks for NULL pointers


diffs (80 lines):

diff --git a/monetdb5/mal/mal_pipelines.c b/monetdb5/mal/mal_pipelines.c
--- a/monetdb5/mal/mal_pipelines.c
+++ b/monetdb5/mal/mal_pipelines.c
@@ -243,8 +243,7 @@ PIPELINEworker(void *T)
                        }
                        freeStack(stk);
                        ma_close(&ma_state);
-                       if (p->wls)
-                               GDKfree(p->wls);
+                       GDKfree(p->wls);
                        MT_sema_up(&s->s);
                }
                GDKfree(p);
diff --git a/monetdb5/modules/mal/pipeline.c b/monetdb5/modules/mal/pipeline.c
--- a/monetdb5/modules/mal/pipeline.c
+++ b/monetdb5/modules/mal/pipeline.c
@@ -132,8 +132,7 @@ typedef struct pp_counter_t {
 static void
 counter_free(pp_counter *c)
 {
-       if (c->cur)
-               GDKfree(c->cur);
+       GDKfree(c->cur);
        MT_lock_destroy(&c->l);
        GDKfree(c);
 }
@@ -347,8 +346,7 @@ concat_free( pp_concat *pcat )
                if (pcat->srcs[i])
                        BBPreclaim(pcat->srcs[i]);
        }
-       if (pcat->cur)
-               GDKfree(pcat->cur);
+       GDKfree(pcat->cur);
        GDKfree(pcat);
 }
 
diff --git a/monetdb5/modules/mal/pp_hash.c b/monetdb5/modules/mal/pp_hash.c
--- a/monetdb5/modules/mal/pp_hash.c
+++ b/monetdb5/modules/mal/pp_hash.c
@@ -56,21 +56,18 @@ _ht_init(hash_table *h)
        }
        return h;
 error:
-       if(h->vals) GDKfree(h->vals);
-       if(h->gids) GDKfree((void *)h->gids);
-       if(h->pgids) GDKfree(h->pgids);
+       GDKfree(h->vals);
+       GDKfree((void *)h->gids);
+       GDKfree(h->pgids);
        return NULL;
 }
 
 static void
 ht_destroy(hash_table *ht)
 {
-       if (ht->vals)
-               GDKfree(ht->vals);
-       if (ht->gids)
-               GDKfree((void*)ht->gids);
-       if (ht->pgids)
-               GDKfree(ht->pgids);
+       GDKfree(ht->vals);
+       GDKfree((void*)ht->gids);
+       GDKfree(ht->pgids);
        if (ht->pinned) {
                for(int i=0; i < ht->pinned_nr; i++) {
                        BBPunfix(ht->pinned[i]->parentid);
@@ -391,9 +388,9 @@ ht_rehash(hash_table *ht)
        }
        return 0;
 error:
-       if(ht->vals) GDKfree(ht->vals);
-       if(ht->gids) GDKfree((void *)ht->gids);
-       if(ht->pgids) GDKfree(ht->pgids);
+       GDKfree(ht->vals);
+       GDKfree((void *)ht->gids);
+       GDKfree(ht->pgids);
        return -1;
 }
 
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to