Changeset: fb1cfc14cddc for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/fb1cfc14cddc
Modified Files:
        gdk/gdk.h
        gdk/gdk_bat.c
Branch: persistent_sketches
Log Message:

Use a init func for tail stats


diffs (36 lines):

diff --git a/gdk/gdk.h b/gdk/gdk.h
--- a/gdk/gdk.h
+++ b/gdk/gdk.h
@@ -1603,6 +1603,17 @@ tstats_sketch(void *tstats)
        assert(((Heap *)tstats)->base);
        return (int32_t *)((Heap *)tstats)->base + 2;
 }
+
+static inline void
+tstats_init(void *tstats)
+{
+       Heap *sh = tstats;
+       assert(sh->base);
+       memset(sh->base, 0, TSTATS_SZ);
+       *tstats_version(sh) = TSTATS_VERSION;
+       *tstats_age(sh) = -1;
+       sh->free = TSTATS_SZ;
+}
 /* tail stats and sketch end */
 
 /* assert that atom width is power of 2, i.e., width == 1<<shift */
diff --git a/gdk/gdk_bat.c b/gdk/gdk_bat.c
--- a/gdk/gdk_bat.c
+++ b/gdk/gdk_bat.c
@@ -366,10 +366,7 @@ COLnew2(oid hseq, int tt, BUN cap, role_
                                HEAPfree(bn->tvheap, true);
                        goto bailout;
                }
-               memset(bn->tstats->base, 0, TSTATS_SZ);
-               *tstats_version(bn->tstats) = TSTATS_VERSION;
-               *tstats_age(bn->tstats) = -1;
-               bn->tstats->free = TSTATS_SZ;
+               tstats_init(bn->tstats);
        }
 
        BBPcacheit(bn, true);
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to