Changeset: c14c0939e666 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=c14c0939e666
Modified Files:
        gdk/gdk.h
        gdk/gdk_align.c
        gdk/gdk_batop.c
        gdk/gdk_cbp.c
        gdk/gdk_col.c
        gdk/gdk_logger.c
        gdk/gdk_search.c
        gdk/gdk_setop.c
        gdk/gdk_storage.c
        gdk/gdk_tm.c
Branch: headless
Log Message:

Use b->count internally instead of COLcount(b).


diffs (truncated from 661 to 300 lines):

diff --git a/gdk/gdk.h b/gdk/gdk.h
--- a/gdk/gdk.h
+++ b/gdk/gdk.h
@@ -1323,7 +1323,7 @@
 #define bunfastins(b, v)                                               \
        do {                                                            \
                register oid _p = COLlast(b);                           \
-               if (_p == BUN_MAX || COLcount(b) == BUN_MAX) {          \
+               if (_p == BUN_MAX || (b)->count == BUN_MAX) {           \
                        GDKerror("bunfastins: bat too large\n");        \
                        goto bunins_failed;                             \
                }                                                       \
@@ -1336,7 +1336,7 @@
 #define bunfastins_TYPE(b, v, TYPE)                                    \
        do {                                                            \
                register oid _p = COLlast(b);                           \
-               if (_p == BUN_MAX || COLcount(b) == BUN_MAX) {          \
+               if (_p == BUN_MAX || (b)->count == BUN_MAX) {           \
                        GDKerror("bunfastins: bat too large\n");        \
                        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
@@ -161,7 +161,7 @@
        COLcheck(b2, "ALIGNsynced: bat 2 required");
 
        /* first try to prove head columns are not in sync */
-       if (COLcount(b1) != COLcount(b2))
+       if (b1->count != b2->count)
                return 0;
        if (ATOMtype(COLtype(b1)) != ATOMtype(COLtype(b2)))
                return 0;
@@ -171,7 +171,7 @@
        /* then try that they are */
        if (b1->batCacheid == b2->batCacheid)
                return 1;       /* same bat. trivial case */
-       if (COLcount(b1) == 0)
+       if (b1->count == 0)
                return 1;       /* empty bats of same type. trivial case */
        if (b1->align && b1->align == b2->align)
                return 1;       /* columns marked as equal by algorithmics */
@@ -415,7 +415,7 @@
                if (n == NULL)
                        goto bailout;
                bs = CBP_desc(n->batCacheid);
-               cnt = COLcount(n) + 1;
+               cnt = n->count + 1;
                nme = CBP_physical(n->batCacheid);
                nmelen = nme ? strlen(nme) : 0;
 
@@ -523,8 +523,8 @@
                GDKerror("VIEWbounds: bat argument missing");
                return;
        }
-       if (h > COLcount(b))
-               h = COLcount(b);
+       if (h > b->count)
+               h = b->count;
        if (h < l)
                h = l;
        l += COLfirst(b);
diff --git a/gdk/gdk_batop.c b/gdk/gdk_batop.c
--- a/gdk/gdk_batop.c
+++ b/gdk/gdk_batop.c
@@ -199,7 +199,7 @@
 COL *
 COLappend(COL *b, COL *n, bit force)
 {
-       oid sz = COLcount(n);
+       oid sz = n->count;
        int fastpath = 1;
 
        if (b == NULL || n == NULL || sz == 0) {
@@ -208,7 +208,7 @@
        ALIGNapp(b, "COLappend", force);
        COLcompatible(b, n);
 
-       if (COLlast(b) + COLcount(n) > BUN_MAX) {
+       if (COLlast(b) + n->count > BUN_MAX) {
                GDKerror("COLappend: combined COLs too large\n");
                return NULL;
        }
@@ -236,10 +236,10 @@
                if (n->type != TYPE_void)
                        f = *(oid *) BUNloc(col_iterator(n), COLfirst(n));
 
-               if (COLcount(b) == 0 && f != oid_nil)
+               if (b->count == 0 && f != oid_nil)
                        COLseqbase(b, f);
-               if (COLdense(n) && COLcount(b) + b->seqbase == f) {
-                       sz += COLcount(b);
+               if (COLdense(n) && b->count + b->seqbase == f) {
+                       sz += b->count;
                        COLsetcount(b, sz);
                        return b;
                }
@@ -250,7 +250,7 @@
        }
 
        /* a hash is useless for void bats */
-       if (b->hash && (2 * b->hash->mask) < (COLcount(b) + sz)) {
+       if (b->hash && (2 * b->hash->mask) < (b->count + sz)) {
                HASHdestroy(b);
        }
        if (b->hash != NULL || (b->key & BOUND2BTRUE) != 0)
@@ -259,7 +259,7 @@
        if (fastpath) {
                oid p, q, r = COLlast(b);
 
-               if (COLcount(b) == 0) {
+               if (b->count == 0) {
                        COLiter ni = col_iterator(n);
 
                        ALIGNset(b, n);
@@ -366,7 +366,7 @@
 
        ERRORcheck(b == NULL, "set:COL required\n");
        ERRORcheck(n == NULL, "set:COL required\n");
-       if (COLcount(n) == 0) {
+       if (n->count == 0) {
                return b;
        }
        ALIGNdel(b, "COLdel", force);
@@ -412,8 +412,8 @@
        COLiter bni, bi = col_iterator(b);
 
        COLcheck(b, "COLslice");
-       if (h > COLcount(b))
-               h = COLcount(b);
+       if (h > b->count)
+               h = b->count;
        if (h < l)
                h = l;
        l += COLfirst(b);
@@ -466,10 +466,10 @@
                bn->dense = TRUE;
                COLseqbase(bn, (oid) (b->seqbase + low));
        } else if (bn->key && bn->type == TYPE_oid) {
-               if (COLcount(bn) == 0) {
+               if (bn->count == 0) {
                        bn->dense = TRUE;
                        COLseqbase(bn, 0);
-               } else if (bn->sorted && *(oid *) BUNloc(bni, COLfirst(bn)) + 
COLcount(bn) - 1 == *(oid *) BUNloc(bni, COLlast(bn) - 1)) {
+               } else if (bn->sorted && *(oid *) BUNloc(bni, COLfirst(bn)) + 
bn->count - 1 == *(oid *) BUNloc(bni, COLlast(bn) - 1)) {
                        bn->dense = TRUE;
                        COLseqbase(bn, *(oid *) BUNloc(bni, COLfirst(bn)));
                }
@@ -494,7 +494,7 @@
 static COL *
 COL_hashselect(COL *b, COL *bn, ptr tl)
 {
-       oid size = COLcount(bn);
+       oid size = bn->count;
        oid i;
 
        COLcheck(b, "COL_hashselect");
@@ -810,7 +810,7 @@
        if (equi && lnil && b->nonil)
                return COLnewdensecol(0);
 
-       batcnt = COLcount(b);
+       batcnt = b->count;
 
        /*
         * @- Slice Implementations
@@ -913,7 +913,7 @@
        if (COLiskey(b)) {
                estimate = 1;
        } else if (s) {
-               estimate = COLcount(s);
+               estimate = s->count;
        } else if (batcnt > 100000) {
                oid _lo = batcnt / 2, _hi = _lo + 105;
                COL *tmp1;
@@ -927,7 +927,7 @@
                        tmp2 = COLsubselect(tmp1, NULL, tl, th, li, hi, anti);
                        if (tmp2) {
                                /* reserve 105% of what has been estimated */
-                               estimate = (oid) ((((lng) COLcount(tmp2)) * 
(lng) batcnt) / LL_CONSTANT(100));
+                               estimate = (oid) ((((lng) tmp2->count) * (lng) 
batcnt) / LL_CONSTANT(100));
                                CBPreclaim(tmp2);
                        }
                        CBPreclaim(tmp1);
@@ -963,12 +963,12 @@
                }
        }
        if (bn == NULL) {
-               return NULL;    /* error occurred */
+               return -1;      /* error occurred */
        }
        ALGODEBUG THRprintf(GDKout, "#COL_select_(b=%s): %s: key=%d, sorted=%d, 
revsorted=%d.\n",
                            COLgetId(b), COLgetId(bn), bn->key, bn->sorted, 
bn->revsorted);
        ESTIDEBUG THRprintf(GDKout, "#COL_select_(b=%s): resultsize: estimated 
" OIDFMT ", got " OIDFMT ".\n",
-                           COLgetId(b), estimate, COLcount(bn));
+                           COLgetId(b), estimate, bn->count);
 
        return bn;
 }
@@ -1010,11 +1010,11 @@
 COLtopN(COL *b, oid topN)
 {
        COLcheck(b, "COLtopN");
-       if (topN > COLcount(b)) {
+       if (topN > b->count) {
                GDKerror("COLtopN: not enough tuples in target\n");
        } else if (b->varsized) {
                HASHdestroy(b);
-               while (COLcount(b) > topN)
+               while (b->count > topN)
                        BUNdelete(b, COLlast(b), FALSE);
        } else {
                HASHdestroy(b);
@@ -1036,7 +1036,7 @@
 
        COLcheck(b, "COLrand_select: source COL required");
 
-       cnt = COLcount(b);
+       cnt = b->count;
        assert(cnt <= BUN_MAX);
 
        if (size > BUN_MAX) {
@@ -1134,7 +1134,7 @@
        if (bn1 == NULL)
                return NULL;
 
-       bn = COLleftfetchjoin(bn1, b, COLcount(bn1));
+       bn = COLleftfetchjoin(bn1, b, bn1->count);
        CBPreclaim(bn1);
        return bn;
 }
@@ -1247,7 +1247,7 @@
                /* b is void-nil, or b is already sorted, hence we return b as 
is */
                return COLcopy(b, b->type, FALSE);
        }
-       if (COLcount(b) <= 1) {
+       if (b->count <= 1) {
                /* with fewer than 2 BUNs, b is ordered, hence we
                 * return b as is */
                b->sorted = 1;
@@ -1266,7 +1266,7 @@
                        if (GDKssort_rev(COLelement(b, COLfirst(b)),
                                         o ? COLelement(o, COLfirst(o)) : NULL,
                                         b->vheap ? b->vheap->base : NULL,
-                                        COLcount(b),
+                                        b->count,
                                         COLwidth(b),
                                         b->type) < 0)
                                return NULL;
@@ -1274,7 +1274,7 @@
                        if (GDKssort(COLelement(b, COLfirst(b)),
                                     o ? COLelement(o, COLfirst(o)) : NULL,
                                     b->vheap ? b->vheap->base : NULL,
-                                    COLcount(b),
+                                    b->count,
                                     COLwidth(b),
                                     b->type) < 0)
                                return NULL;
@@ -1284,14 +1284,14 @@
                        GDKqsort_rev(COLelement(b, COLfirst(b)),
                                     o ? COLelement(o, COLfirst(o)) : NULL,
                                     b->vheap ? b->vheap->base : NULL,
-                                    COLcount(b),
+                                    b->count,
                                     COLwidth(b),
                                     b->type);
                else
                        GDKqsort(COLelement(b, COLfirst(b)),
                                 o ? COLelement(o, COLfirst(o)) : NULL,
                                 b->vheap ? b->vheap->base : NULL,
-                                COLcount(b),
+                                b->count,
                                 COLwidth(b),
                                 b->type);
        }
@@ -1355,7 +1355,7 @@
                 * copy/view of b */
                return COLcopy(b, b->type, FALSE);
        }
-       if (COLcount(b) <= 1) {
+       if (b->count <= 1) {
                COLiter bi = col_iterator(b);
 
                /* with fewer than 2 BUNs, b is ordered, hence we
@@ -1486,7 +1486,7 @@
        COL *bn;
 
        COLcheck(b, "COLgroup");
-       bn = COLnew(TYPE_oid, COLcount(b));
+       bn = COLnew(TYPE_oid, b->count);
        if (bn == NULL)
                return NULL;
        r = COLfirst(bn);
@@ -1528,7 +1528,7 @@
                COLcheck(c, "COLmark_grp");
                ERRORcheck(c->type != TYPE_void && c->type != TYPE_oid,
                           "COLmark_grp: COL c must be oid.\n");
-               ERRORcheck(COLcount(c) != COLcount(g),
+               ERRORcheck(c->count != g->count,
                           "COLmark_grp: base oid COL must be aligned with 
group COL.\n");
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to