Changeset: 8ae220bc4174 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=8ae220bc4174
Modified Files:
        gdk/gdk.h
        gdk/gdk_align.c
        gdk/gdk_bbp.c
        gdk/gdk_cross.c
        gdk/gdk_delta.c
        gdk/gdk_group.c
        gdk/gdk_heap.c
        gdk/gdk_imprints.c
        gdk/gdk_orderidx.c
        gdk/gdk_project.c
        gdk/gdk_sample.c
        gdk/gdk_storage.c
        gdk/gdk_string.c
        gdk/gdk_tm.c
        geom/monetdb5/geom.c
        monetdb5/extras/rapi/converters.c.h
        monetdb5/modules/atoms/batxml.c
        monetdb5/modules/atoms/blob.c
        monetdb5/modules/atoms/json.c
        monetdb5/modules/atoms/mtime.c
        monetdb5/modules/kernel/algebra.c
        monetdb5/modules/kernel/bat5.c
        monetdb5/modules/kernel/batcolor.c
        monetdb5/modules/kernel/batstr.c
        monetdb5/modules/kernel/microbenchmark.c
        monetdb5/modules/mal/manifold.c
        monetdb5/modules/mal/mkey.c
        monetdb5/modules/mal/orderidx.c
        monetdb5/modules/mal/pcre.c
        monetdb5/modules/mal/remote.c
        monetdb5/modules/mal/tablet.c
        sql/backends/monet5/UDF/capi/capi.c
        sql/backends/monet5/UDF/pyapi/conversion.c
        sql/backends/monet5/UDF/pyapi/convert_loops.h
        sql/backends/monet5/UDF/pyapi/emit.c
        sql/backends/monet5/UDF/pyapi/pyloader.c
        sql/backends/monet5/UDF/udf/udf.c
        sql/backends/monet5/generator/generator.c
        sql/backends/monet5/sql.c
        sql/backends/monet5/sql_cast_impl_up_to_flt.h
        sql/backends/monet5/sql_fround_impl.h
        sql/backends/monet5/sql_rank.c
        sql/backends/monet5/sql_result.c
        sql/backends/monet5/sql_round_impl.h
        sql/backends/monet5/vaults/bam/bam_lib.c
        sql/backends/monet5/vaults/fits/fits.c
        sql/backends/monet5/vaults/lidar/lidar.c
        sql/backends/monet5/vaults/netcdf/netcdf.c
Branch: default
Log Message:

Use bool.


diffs (truncated from 3073 to 300 lines):

diff --git a/gdk/gdk.h b/gdk/gdk.h
--- a/gdk/gdk.h
+++ b/gdk/gdk.h
@@ -782,14 +782,15 @@ typedef struct BAT {
 
        /* dynamic bat properties */
        MT_Id creator_tid;      /* which thread created it */
-       uint32_t
+       bool
         batCopiedtodisk:1,     /* once written */
         batDirtyflushed:1,     /* was dirty before commit started? */
-        batDirtydesc:1,        /* bat descriptor dirty marker */
+        batDirtydesc:1;        /* bat descriptor dirty marker */
+       uint8_t /* adjacent bit fields are packed together (if they fit) */
         batRestricted:2,       /* access privileges */
-        batPersistence:1,      /* should the BAT persist on disk? */
-        batRole:8,             /* role of the bat */
-        unused:18;             /* value=0 for now (sneakily used by mat.c) */
+        batPersistence:1;      /* should the BAT persist on disk? */
+       uint8_t batRole;        /* role of the bat */
+       uint16_t unused;        /* value=0 for now (sneakily used by mat.c) */
        int batSharecnt;        /* incoming view count */
 
        /* delta status administration */
diff --git a/gdk/gdk_align.c b/gdk/gdk_align.c
--- a/gdk/gdk_align.c
+++ b/gdk/gdk_align.c
@@ -115,7 +115,7 @@ VIEWcreate(oid seq, BAT *b)
         * with a copy from the parent.  Clear the copied flag since
         * our heap was not copied from our parent(s) even if our
         * parent's heap was copied from its parent. */
-       bn->theap.copied = 0;
+       bn->theap.copied = false;
        bn->tprops = NULL;
 
        /* correct values after copy of head and tail info */
@@ -315,7 +315,7 @@ VIEWreset(BAT *b)
                b->batRestricted = BAT_WRITE;
 
                b->tkey = BATtkey(v);
-               b->tunique = 0;
+               b->tunique = false;
 
                /* copy the heaps */
                b->theap = tail;
@@ -336,11 +336,11 @@ VIEWreset(BAT *b)
                        v->theap.parentid = 0;
                }
                b->batSharecnt = 0;
-               b->batCopiedtodisk = 0;
+               b->batCopiedtodisk = false;
                b->batDirtydesc = true;
 
                b->tkey = BATtkey(v);
-               b->tunique = 0;
+               b->tunique = false;
 
                /* make the BAT empty and insert all again */
                DELTAinit(b);
diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c
--- a/gdk/gdk_bbp.c
+++ b/gdk/gdk_bbp.c
@@ -474,7 +474,7 @@ fixstroffheap(BAT *b, int *restrict offs
        sprintf(filename, "BACKUP%c%s", DIR_SEP, bnme);
 
        width = b->twidth;
-       h2.dirty = 0;
+       h2.dirty = false;
        if (emptyoff == 0) {
                /* no legitimate empty string in the string heap; we
                 * now make a backup of the old string heap and create
@@ -494,13 +494,13 @@ fixstroffheap(BAT *b, int *restrict offs
                h1 = *b->tvheap;
                snprintf(h1.filename, sizeof(h1.filename), "%s.theap", 
filename);
                h1.base = NULL;
-               h1.dirty = 0;
+               h1.dirty = false;
                if (HEAPload(&h1, filename, "theap", false) != GDK_SUCCEED)
                        GDKfatal("fixstroffheap: loading old tail heap "
                                 "for BAT %d failed\n", b->batCacheid);
                memcpy(h2.base, h1.base, h2.free);
                HEAPfree(&h1, false);
-               h2.dirty = 1;
+               h2.dirty = true;
                if ((*BATatoms[TYPE_str].atomPut)(&h2, &emptyoff, "") == 0)
                        GDKfatal("fixstroffheap: cannot insert empty string "
                                 "in BAT %d failed\n", b->batCacheid);
@@ -521,7 +521,7 @@ fixstroffheap(BAT *b, int *restrict offs
        h1 = b->theap;
        snprintf(h1.filename, sizeof(h1.filename), "%s.tail", filename);
        h1.base = NULL;
-       h1.dirty = 0;
+       h1.dirty = false;
        if (HEAPload(&h1, filename, "tail", false) != GDK_SUCCEED)
                GDKfatal("fixstroffheap: loading old tail heap "
                         "for BAT %d failed\n", b->batCacheid);
@@ -604,7 +604,7 @@ fixstroffheap(BAT *b, int *restrict offs
        } else {
                /* offset heap was fixed */
                b->twidth = width;
-               b->batDirtydesc = 1;
+               b->batDirtydesc = true;
                if (h2.dirty) {
                        /* in addition, we added an empty string to
                         * the string heap */
@@ -704,7 +704,7 @@ fixfltheap(BAT *b)
        h1 = b->theap;
        snprintf(h1.filename, sizeof(h1.filename), "%s.tail", filename);
        h1.base = NULL;
-       h1.dirty = 0;
+       h1.dirty = false;
        if (HEAPload(&h1, filename, "tail", false) != GDK_SUCCEED)
                GDKfatal("fixfltheap: loading old tail heap "
                         "for BAT %d failed\n", b->batCacheid);
@@ -725,7 +725,7 @@ fixfltheap(BAT *b)
 
                for (i = 0; i < b->batCount; i++) {
                        if (o[i] == GDK_flt_min) {
-                               b->tnil = 1;
+                               b->tnil = true;
                                n[i] = flt_nil;
                                nofix = false;
                        } else {
@@ -740,7 +740,7 @@ fixfltheap(BAT *b)
 
                for (i = 0; i < b->batCount; i++) {
                        if (o[i] == GDK_dbl_min) {
-                               b->tnil = 1;
+                               b->tnil = true;
                                n[i] = dbl_nil;
                                nofix = false;
                        } else {
@@ -764,7 +764,7 @@ fixfltheap(BAT *b)
                            o[i].xmax == GDK_flt_min ||
                            o[i].ymin == GDK_flt_min ||
                            o[i].ymax == GDK_flt_min) {
-                               b->tnil = 1;
+                               b->tnil = true;
                                n[i].xmin = n[i].xmax = n[i].ymin = n[i].ymax = 
flt_nil;
                                nofix = false;
                        } else {
@@ -784,7 +784,7 @@ fixfltheap(BAT *b)
                        GDKfatal("fixfltheap: cannot restore backup of 
%s.tail\n", nme);
        } else {
                /* heap was fixed */
-               b->batDirtydesc = 1;
+               b->batDirtydesc = true;
                if (HEAPsave(&h2, nme, "tail") != GDK_SUCCEED)
                        GDKfatal("fixfltheap: saving heap failed\n");
                HEAPfree(&h2, false);
@@ -970,10 +970,10 @@ heapinit(BAT *b, const char *buf, int *h
        snprintf(b->theap.filename, sizeof(b->theap.filename),
                 "%s.tail", filename);
        b->theap.storage = (storage_t) storage;
-       b->theap.copied = 0;
+       b->theap.copied = false;
        b->theap.newstorage = (storage_t) storage;
        b->theap.farmid = BBPselectfarm(PERSISTENT, b->ttype, offheap);
-       b->theap.dirty = 0;
+       b->theap.dirty = false;
        if (b->theap.free > b->theap.size)
                GDKfatal("BBPinit: \"free\" value larger than \"size\" in heap 
of bat %d\n", (int) bid);
        return n;
@@ -1001,11 +1001,11 @@ vheapinit(BAT *b, const char *buf, int h
                snprintf(b->tvheap->filename, sizeof(b->tvheap->filename),
                         "%s.theap", filename);
                b->tvheap->storage = (storage_t) storage;
-               b->tvheap->copied = 0;
+               b->tvheap->copied = false;
                b->tvheap->hashash = hashash != 0;
-               b->tvheap->cleanhash = 1;
+               b->tvheap->cleanhash = true;
                b->tvheap->newstorage = (storage_t) storage;
-               b->tvheap->dirty = 0;
+               b->tvheap->dirty = false;
                b->tvheap->parentid = bid;
                b->tvheap->farmid = BBPselectfarm(PERSISTENT, b->ttype, 
varheap);
                if (b->tvheap->free > b->tvheap->size)
@@ -1104,7 +1104,7 @@ BBPreadEntries(FILE *fp, unsigned bbpver
                if (BATroles(bn, NULL) != GDK_SUCCEED)
                        GDKfatal("BBPinit: BATroles failed.");
                bn->batPersistence = PERSISTENT;
-               bn->batCopiedtodisk = 1;
+               bn->batCopiedtodisk = true;
                bn->batRestricted = (properties & 0x06) >> 1;
                bn->batCount = (BUN) count;
                bn->batInserted = bn->batCount;
@@ -1124,7 +1124,7 @@ BBPreadEntries(FILE *fp, unsigned bbpver
                    (bn->tnokey[0] != 0 || bn->tnokey[1] != 0)) {
                        /* we don't trust the nokey values */
                        bn->tnokey[0] = bn->tnokey[1] = 0;
-                       bn->batDirtydesc = 1;
+                       bn->batDirtydesc = true;
                }
 
                if (buf[nread] != '\n' && buf[nread] != ' ')
@@ -2269,7 +2269,7 @@ BBPrename(bat bid, const char *nme)
        if (tmpid == 0) {
                BBP_insert(bid);
        }
-       b->batDirtydesc = 1;
+       b->batDirtydesc = true;
        if (b->batPersistence == PERSISTENT) {
                bool lock = locked_by == 0 || locked_by != MT_getpid();
 
@@ -2400,7 +2400,7 @@ incref(bat i, bool logical, bool lock)
                assert(!logical);
                if (tp) {
                        BAT *pb;
-                       incref(tp, 0, lock);
+                       incref(tp, false, lock);
                        pb = getBBPdescriptor(tp, lock);
                        if (!pb) 
                                return 0;
@@ -2861,7 +2861,7 @@ BBPquickdesc(bat bid, bool delaccess)
        b = (BAT *) BBPgetdesc(bid);
        if (b == NULL ||
            complexatom(b->ttype, delaccess)) {
-               b = BATload_intern(bid, 1);
+               b = BATload_intern(bid, true);
                BBPin++;
        }
        return b;
@@ -3149,7 +3149,7 @@ BBPbackup(BAT *b, bool subcommit)
        if (BBPprepare(subcommit) != GDK_SUCCEED) {
                return GDK_FAIL;
        }
-       if (b->batCopiedtodisk == 0 || b->batPersistence != PERSISTENT) {
+       if (!b->batCopiedtodisk || b->batPersistence != PERSISTENT) {
                return GDK_SUCCEED;
        }
        /* determine location dir and physical suffix */
@@ -3656,10 +3656,10 @@ BBPdiskscan(const char *parent, size_t b
                                delete = true;
                        } else if (strncmp(p + 1, "tail", 4) == 0) {
                                BAT *b = getdesc(bid);
-                               delete = (b == NULL || !b->ttype || 
b->batCopiedtodisk == 0);
+                               delete = (b == NULL || !b->ttype || 
!b->batCopiedtodisk);
                        } else if (strncmp(p + 1, "theap", 5) == 0) {
                                BAT *b = getdesc(bid);
-                               delete = (b == NULL || !b->tvheap || 
b->batCopiedtodisk == 0);
+                               delete = (b == NULL || !b->tvheap || 
!b->batCopiedtodisk);
                        } else if (strncmp(p + 1, "thash", 5) == 0) {
 #ifdef PERSISTENTHASH
                                BAT *b = getdesc(bid);
diff --git a/gdk/gdk_cross.c b/gdk/gdk_cross.c
--- a/gdk/gdk_cross.c
+++ b/gdk/gdk_cross.c
@@ -44,11 +44,11 @@ BATsubcross(BAT **r1p, BAT **r2p, BAT *l
        }
 
        BATsetcount(bn1, cnt1 * cnt2);
-       bn1->tsorted = 1;
+       bn1->tsorted = true;
        bn1->trevsorted = cnt1 <= 1;
        bn1->tkey = cnt2 <= 1;
-       bn1->tnil = 0;
-       bn1->tnonil = 1;
+       bn1->tnil = false;
+       bn1->tnonil = true;
        p = (oid *) Tloc(bn1, 0);
        if (lcand) {
                for (i = 0; i < cnt1; i++)
@@ -67,8 +67,8 @@ BATsubcross(BAT **r1p, BAT **r2p, BAT *l
        bn2->tsorted = cnt1 <= 1 || cnt2 <= 1;
        bn2->trevsorted = cnt2 <= 1;
        bn2->tkey = cnt1 <= 1;
-       bn2->tnil = 0;
-       bn2->tnonil = 1;
+       bn2->tnil = false;
+       bn2->tnonil = true;
        p = (oid *) Tloc(bn2, 0);
        if (rcand) {
                for (i = 0; i < cnt1; i++)
diff --git a/gdk/gdk_delta.c b/gdk/gdk_delta.c
--- a/gdk/gdk_delta.c
+++ b/gdk/gdk_delta.c
@@ -41,10 +41,10 @@ BATcommit(BAT *b)
                           b->batInserted,
                           b->theap.base);
        if (!BATdirty(b)) {
-               b->batDirtyflushed = 0;
+               b->batDirtyflushed = false;
        }
        if (DELTAdirty(b)) {
-               b->batDirtydesc = 1;
+               b->batDirtydesc = true;
        }
        b->batInserted = BUNlast(b);
        DELTADEBUG fprintf(stderr, "#BATcommit2 %s free %zu ins " BUNFMT " base 
%p\n",
@@ -63,9 +63,9 @@ BATfakeCommit(BAT *b)
 {
        if (b) {
                BATcommit(b);
-               b->batDirtydesc = b->theap.dirty = 0;
+               b->batDirtydesc = b->theap.dirty = false;
                if (b->tvheap)
-                       b->tvheap->dirty = 0;
+                       b->tvheap->dirty = false;
        }
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to