Changeset: f5ac3ad33440 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=f5ac3ad33440
Modified Files:
        gdk/gdk.h
        gdk/gdk_align.c
        gdk/gdk_batop.c
        gdk/gdk_col.c
        gdk/gdk_delta.c
        gdk/gdk_search.c
Branch: headless
Log Message:

Use b->capacity internally instead of COLcapacity(b).


diffs (164 lines):

diff --git a/gdk/gdk.h b/gdk/gdk.h
--- a/gdk/gdk.h
+++ b/gdk/gdk.h
@@ -1327,7 +1327,7 @@
                        GDKerror("bunfastins: bat too large\n");        \
                        goto bunins_failed;                             \
                }                                                       \
-               if (_p + 1 > COLcapacity(b)) {                          \
+               if (_p + 1 > (b)->capacity) {                           \
                        if (COLextend((b), COLgrows(b)) == NULL)        \
                                goto bunins_failed;                     \
                }                                                       \
@@ -1340,7 +1340,7 @@
                        GDKerror("bunfastins: bat too large\n");        \
                        goto bunins_failed;                             \
                }                                                       \
-               if (_p + 1 > COLcapacity(b)) {                          \
+               if (_p + 1 > (b)->capacity) {                           \
                        if (COLextend((b), COLgrows(b)) == NULL)        \
                                goto bunins_failed;                     \
                }                                                       \
diff --git a/gdk/gdk_align.c b/gdk/gdk_align.c
--- a/gdk/gdk_align.c
+++ b/gdk/gdk_align.c
@@ -299,7 +299,7 @@
 
        COLcheck(b, "COLmaterialize");
        assert(!isVIEW(b));
-       cnt = COLcapacity(b);
+       cnt = b->capacity;
        head = b->heap;
        p = COLfirst(b);
        q = COLlast(b);
diff --git a/gdk/gdk_batop.c b/gdk/gdk_batop.c
--- a/gdk/gdk_batop.c
+++ b/gdk/gdk_batop.c
@@ -83,7 +83,7 @@
            b->vheap->hashash == n->vheap->hashash &&
            (b->key & BOUND2BTRUE) == 0 &&
            (VIEWparent(n) == 0 ||
-            COLcapacity(CBP_cache(VIEWparent(n))) < 2 * n->count)) {
+            CBP_cache(VIEWparent(n))->capacity < 2 * n->count)) {
                /* append string heaps */
                toff = b->count == 0 ? 0 : b->vheap->size;
                /* make sure we get alignment right */
@@ -217,7 +217,7 @@
        COLaccessBegin(b, USE_HASH, MMAP_WILLNEED);
        COLaccessBegin(n, USE_HEAP, MMAP_SEQUENTIAL);
 
-       if (sz > COLcapacity(b) - COLlast(b)) {
+       if (sz > b->capacity - COLlast(b)) {
                /* if needed space exceeds a normal growth extend just
                 * with what's needed */
                oid ncap = COLlast(b) + sz;
@@ -508,8 +508,8 @@
                oid r;
                COLiter bi = col_iterator(b);
 
-               assert(COLcapacity(bn) <= BUN_MAX);
-               r = (oid) COLcapacity(bn);
+               assert(bn->capacity <= BUN_MAX);
+               r = (oid) bn->capacity;
                /* the hash implementation ordinarily causes the order
                 * to be reverse sorted (but we'll check) */
                bn->revsorted = 1;
diff --git a/gdk/gdk_col.c b/gdk/gdk_col.c
--- a/gdk/gdk_col.c
+++ b/gdk/gdk_col.c
@@ -357,7 +357,7 @@
 
        COLcheck(b, "COLgrows");
 
-       newcap = oldcap = COLcapacity(b);
+       newcap = oldcap = b->capacity;
        if (newcap < COLTINY)
                newcap = 2 * COLTINY;
        else if (newcap < 10 * COLTINY)
@@ -403,7 +403,7 @@
         * value, otherwise you may easily corrupt the administration of
         * malloc.
         */
-       if (newcap <= COLcapacity(b)) {
+       if (newcap <= b->capacity) {
                return b;
        }
 
@@ -705,7 +705,7 @@
                        bat hp = VIEWparent(b);
 
                        if (/* reduced slice view: do not copy too much garbage 
*/
-                           hp != 0 && COLcapacity(CBP_cache(hp)) > cnt + cnt)
+                               hp != 0 && CBP_cache(hp)->capacity > cnt + cnt)
                                bunstocopy = cnt;
                }
 
@@ -716,7 +716,7 @@
                if (bn->varsized && bn->type) {
                        bn->shift = b->shift;
                        bn->width = b->width;
-                       if (HEAPextend(&bn->heap, COLcapacity(bn) << bn->shift) 
< 0)
+                       if (HEAPextend(&bn->heap, bn->capacity << bn->shift) < 
0)
                                goto bunins_failed;
                }
 
diff --git a/gdk/gdk_delta.c b/gdk/gdk_delta.c
--- a/gdk/gdk_delta.c
+++ b/gdk/gdk_delta.c
@@ -194,7 +194,7 @@
                }
                return bn;
        }
-       bn = COLnew(COLtype(b), COLcapacity(b));
+       bn = COLnew(COLtype(b), b->capacity);
        if (bn == NULL) {
                return bn;
        }
@@ -223,7 +223,7 @@
                }
                return bn;
        }
-       bn = COLnew(COLtype(b), COLcapacity(b));
+       bn = COLnew(COLtype(b), b->capacity);
        if (bn == NULL) {
                return bn;
        }
@@ -252,7 +252,7 @@
                }
                return bn;
        }
-       bn = COLnew(COLtype(b), COLcapacity(b));
+       bn = COLnew(COLtype(b), b->capacity);
        if (bn == NULL) {
                return bn;
        }
diff --git a/gdk/gdk_search.c b/gdk/gdk_search.c
--- a/gdk/gdk_search.c
+++ b/gdk/gdk_search.c
@@ -72,7 +72,7 @@
  * the hash table and a collision list. A one-to-one mapping exists between
  * the COL and the collision list using the oid index. NOTE: we alloc the
  * link list as a parallel array to the oid array; hence the hash link array 
has
- * the same size as COLcapacity(b) (not b->count). This allows us in the
+ * the same size as b->capacity (not b->count). This allows us in the
  * oid insert and delete to assume that there is hash space iff there is oid
  * space. If there is no oid space, the COLextend now destroys the hash table.
  *
@@ -191,7 +191,7 @@
                /* cnt = 0, hopefully there is a proper capacity from which
                 * we can derive enough information */
                if (!cnt)
-                       cnt = COLcapacity(b);
+                       cnt = b->capacity;
 
                if (b->type == TYPE_void) {
                        if (b->seqbase == oid_nil) {
@@ -240,7 +240,7 @@
                                sprintf(hp->filename, "%s.thash", nme);
                        if (hp == NULL ||
                            hp->filename == NULL ||
-                           (h = HASHnew(hp, ATOMtype(b->type), COLcapacity(b), 
mask)) == NULL) {
+                           (h = HASHnew(hp, ATOMtype(b->type), b->capacity, 
mask)) == NULL) {
                                gdk_unset_lock(GDKhashLock(ABS(b->batCacheid) & 
CBP_BATMASK), "COLhash");
                                if (hp != NULL) {
                                        GDKfree(hp->filename);
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to