Changeset: 0920eec115f6 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/0920eec115f6
Modified Files:
        gdk/gdk_bat.c
Branch: default
Log Message:

Remove unnecessary indentation.


diffs (235 lines):

diff --git a/gdk/gdk_bat.c b/gdk/gdk_bat.c
--- a/gdk/gdk_bat.c
+++ b/gdk/gdk_bat.c
@@ -711,118 +711,119 @@ COLcopy2(BAT *b, int tt, bool writable, 
                }
                bat_iterator_end(&bi);
                return bn;
-       } else {
-               /* check whether we need case (4); BUN-by-BUN copy (by
-                * setting slowcopy to true) */
-               if (ATOMsize(tt) != ATOMsize(bi.type)) {
-                       /* oops, void materialization */
+       }
+
+       /* check whether we need case (4); BUN-by-BUN copy (by
+        * setting slowcopy to true) */
+       if (ATOMsize(tt) != ATOMsize(bi.type)) {
+               /* oops, void materialization */
+               slowcopy = true;
+               mayshare = false;
+       } else if (!mayshare) {
+               if (bi.h && bi.h->parentid != b->batCacheid &&
+                   BATcapacity(BBP_desc(bi.h->parentid)) > bi.count + 
bi.count) {
+                       /* reduced slice view: do not copy too much
+                        * garbage */
+                       slowcopy = true;
+               } else if (bi.vh && bi.vh->parentid != b->batCacheid &&
+                          BATcount(BBP_desc(bi.vh->parentid)) > bi.count + 
bi.count) {
+                       /* reduced vheap view: do not copy too much
+                        * garbage; this really is a heuristic since the
+                        * vheap could be used completely, even if the
+                        * offset heap is only (less than) half the size
+                        * of the parent's offset heap */
                        slowcopy = true;
-                       mayshare = false;
-               } else if (!mayshare) {
-                       if (bi.h && bi.h->parentid != b->batCacheid &&
-                           BATcapacity(BBP_desc(bi.h->parentid)) > bi.count + 
bi.count) {
-                               /* reduced slice view: do not copy too much
-                                * garbage */
-                               slowcopy = true;
-                       } else if (bi.vh && bi.vh->parentid != b->batCacheid &&
-                                  BATcount(BBP_desc(bi.vh->parentid)) > 
bi.count + bi.count) {
-                               /* reduced vheap view: do not copy too much
-                                * garbage; this really is a heuristic since the
-                                * vheap could be used completely, even if the
-                                * offset heap is only (less than) half the size
-                                * of the parent's offset heap */
-                               slowcopy = true;
+               }
+       }
+
+       bn = COLnew2(b->hseqbase, tt, bi.count, role, bi.width);
+       if (bn == NULL) {
+               goto bunins_failed;
+       }
+       if (bn->tvheap != NULL && bn->tvheap->base == NULL && !mayshare) {
+               /* this combination can happen since the last
+                * argument of COLnew2 not being zero triggers a
+                * skip in the allocation of the tvheap */
+               if (ATOMheap(bn->ttype, bn->tvheap, bn->batCapacity) != 
GDK_SUCCEED) {
+                       goto bunins_failed;
+               }
+       }
+
+       if (tt == TYPE_void) {
+               /* case (2): a void,void result => nothing to
+                * copy! */
+               bn->theap->free = 0;
+       } else if (!slowcopy) {
+               /* case (3): just copy the heaps */
+               if (bn->tvheap) {
+                       if (mayshare) {
+                               HEAPincref(bi.vh);
+                               HEAPdecref(bn->tvheap, true);
+                               BBPretain(bi.vh->parentid);
+                               bn->tvheap = bi.vh;
+                       } else {
+                               if (HEAPextend(bn->tvheap, bi.vhfree, true) != 
GDK_SUCCEED)
+                                       goto bunins_failed;
+                               memcpy(bn->tvheap->base, bi.vh->base, 
bi.vhfree);
+                               bn->tvheap->free = bi.vhfree;
+                               bn->tvheap->dirty = true;
+                               bn->tascii = bi.ascii;
+                               if (ATOMstorage(b->ttype) == TYPE_str && 
bi.vhfree >= GDK_STRHASHSIZE)
+                                       memcpy(bn->tvheap->base, strhash, 
GDK_STRHASHSIZE);
                        }
                }
+               memcpy(bn->theap->base, bi.base, bi.hfree);
+               bn->theap->free = bi.hfree;
+               bn->theap->dirty = true;
 
-               bn = COLnew2(b->hseqbase, tt, bi.count, role, bi.width);
-               if (bn == NULL) {
-                       goto bunins_failed;
-               }
-               if (bn->tvheap != NULL && bn->tvheap->base == NULL && 
!mayshare) {
-                       /* this combination can happen since the last
-                        * argument of COLnew2 not being zero triggers a
-                        * skip in the allocation of the tvheap */
-                       if (ATOMheap(bn->ttype, bn->tvheap, bn->batCapacity) != 
GDK_SUCCEED) {
+               /* make sure we use the correct capacity */
+               if (ATOMstorage(bn->ttype) == TYPE_msk)
+                       bn->batCapacity = (BUN) (bn->theap->size * 8);
+               else if (bn->ttype)
+                       bn->batCapacity = (BUN) (bn->theap->size >> bn->tshift);
+               else
+                       bn->batCapacity = 0;
+       } else if (tt != TYPE_void || ATOMextern(tt)) {
+               /* case (4): one-by-one BUN insert (really slow) */
+               QryCtx *qry_ctx = MT_thread_get_qry_ctx();
+
+               TIMEOUT_LOOP_IDX_DECL(p, bi.count, qry_ctx) {
+                       const void *t = BUNtail(bi, p);
+
+                       if (bunfastapp_nocheck(bn, t) != GDK_SUCCEED) {
                                goto bunins_failed;
                        }
                }
-
-               if (tt == TYPE_void) {
-                       /* case (2): a void,void result => nothing to
-                        * copy! */
-                       bn->theap->free = 0;
-               } else if (!slowcopy) {
-                       /* case (3): just copy the heaps */
-                       if (bn->tvheap) {
-                               if (mayshare) {
-                                       HEAPincref(bi.vh);
-                                       HEAPdecref(bn->tvheap, true);
-                                       BBPretain(bi.vh->parentid);
-                                       bn->tvheap = bi.vh;
-                               } else {
-                                       if (HEAPextend(bn->tvheap, bi.vhfree, 
true) != GDK_SUCCEED)
-                                               goto bunins_failed;
-                                       memcpy(bn->tvheap->base, bi.vh->base, 
bi.vhfree);
-                                       bn->tvheap->free = bi.vhfree;
-                                       bn->tvheap->dirty = true;
-                                       bn->tascii = bi.ascii;
-                                       if (ATOMstorage(b->ttype) == TYPE_str 
&& bi.vhfree >= GDK_STRHASHSIZE)
-                                               memcpy(bn->tvheap->base, 
strhash, GDK_STRHASHSIZE);
-                               }
-                       }
-                       memcpy(bn->theap->base, bi.base, bi.hfree);
-                       bn->theap->free = bi.hfree;
-                       bn->theap->dirty = true;
+               TIMEOUT_CHECK(qry_ctx, 
GOTO_LABEL_TIMEOUT_HANDLER(bunins_failed, qry_ctx));
+               bn->theap->dirty |= bi.count > 0;
+       } else if (tt != TYPE_void && bi.type == TYPE_void) {
+               /* case (4): optimized for unary void
+                * materialization */
+               oid cur = bi.tseq, *dst = (oid *) Tloc(bn, 0);
+               const oid inc = !is_oid_nil(cur);
 
-                       /* make sure we use the correct capacity */
-                       if (ATOMstorage(bn->ttype) == TYPE_msk)
-                               bn->batCapacity = (BUN) (bn->theap->size * 8);
-                       else if (bn->ttype)
-                               bn->batCapacity = (BUN) (bn->theap->size >> 
bn->tshift);
-                       else
-                               bn->batCapacity = 0;
-               } else if (tt != TYPE_void || ATOMextern(tt)) {
-                       /* case (4): one-by-one BUN insert (really slow) */
-                       QryCtx *qry_ctx = MT_thread_get_qry_ctx();
-
-                       TIMEOUT_LOOP_IDX_DECL(p, bi.count, qry_ctx) {
-                               const void *t = BUNtail(bi, p);
+               for (BUN p = 0; p < bi.count; p++) {
+                       dst[p] = cur;
+                       cur += inc;
+               }
+               bn->theap->free = bi.count * sizeof(oid);
+               bn->theap->dirty |= bi.count > 0;
+       } else if (ATOMstorage(bi.type) == TYPE_msk) {
+               /* convert number of bits to number of bytes,
+                * and round the latter up to a multiple of
+                * 4 (copy in units of 4 bytes) */
+               bn->theap->free = ((bi.count + 31) / 32) * 4;
+               memcpy(Tloc(bn, 0), bi.base, bn->theap->free);
+               bn->theap->dirty |= bi.count > 0;
+       } else {
+               /* case (4): optimized for simple array copy */
+               bn->theap->free = bi.count << bn->tshift;
+               memcpy(Tloc(bn, 0), bi.base, bn->theap->free);
+               bn->theap->dirty |= bi.count > 0;
+       }
+       /* copy all properties (size+other) from the source bat */
+       BATsetcount(bn, bi.count);
 
-                               if (bunfastapp_nocheck(bn, t) != GDK_SUCCEED) {
-                                       goto bunins_failed;
-                               }
-                       }
-                       TIMEOUT_CHECK(qry_ctx, 
GOTO_LABEL_TIMEOUT_HANDLER(bunins_failed, qry_ctx));
-                       bn->theap->dirty |= bi.count > 0;
-               } else if (tt != TYPE_void && bi.type == TYPE_void) {
-                       /* case (4): optimized for unary void
-                        * materialization */
-                       oid cur = bi.tseq, *dst = (oid *) Tloc(bn, 0);
-                       const oid inc = !is_oid_nil(cur);
-
-                       for (BUN p = 0; p < bi.count; p++) {
-                               dst[p] = cur;
-                               cur += inc;
-                       }
-                       bn->theap->free = bi.count * sizeof(oid);
-                       bn->theap->dirty |= bi.count > 0;
-               } else if (ATOMstorage(bi.type) == TYPE_msk) {
-                       /* convert number of bits to number of bytes,
-                        * and round the latter up to a multiple of
-                        * 4 (copy in units of 4 bytes) */
-                       bn->theap->free = ((bi.count + 31) / 32) * 4;
-                       memcpy(Tloc(bn, 0), bi.base, bn->theap->free);
-                       bn->theap->dirty |= bi.count > 0;
-               } else {
-                       /* case (4): optimized for simple array copy */
-                       bn->theap->free = bi.count << bn->tshift;
-                       memcpy(Tloc(bn, 0), bi.base, bn->theap->free);
-                       bn->theap->dirty |= bi.count > 0;
-               }
-               /* copy all properties (size+other) from the source bat */
-               BATsetcount(bn, bi.count);
-       }
        /* set properties (note that types may have changed in the copy) */
        if (ATOMtype(tt) == ATOMtype(bi.type)) {
                if (ATOMtype(tt) == TYPE_oid) {
@@ -894,7 +895,7 @@ COLcopy2(BAT *b, int tt, bool writable, 
        TRC_DEBUG(ALGO, ALGOBATFMT " -> " ALGOBATFMT "\n",
                  ALGOBATPAR(b), ALGOBATPAR(bn));
        return bn;
-      bunins_failed:
+  bunins_failed:
        bat_iterator_end(&bi);
        BBPreclaim(bn);
        return NULL;
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to