Changeset: a7f324ced49c for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/a7f324ced49c
Modified Files:
gdk/gdk.h
gdk/gdk_heap.c
Branch: default
Log Message:
Add some const qualifiers and some attribute declrarations.
diffs (70 lines):
diff --git a/gdk/gdk.h b/gdk/gdk.h
--- a/gdk/gdk.h
+++ b/gdk/gdk.h
@@ -433,19 +433,19 @@ typedef struct BAT {
/* some access functions for the bitmask type */
static inline void
-mskSet(BAT *b, BUN p)
+mskSet(const BAT *b, BUN p)
{
((uint32_t *) b->theap->base)[p / 32] |= 1U << (p % 32);
}
static inline void
-mskClr(BAT *b, BUN p)
+mskClr(const BAT *b, BUN p)
{
((uint32_t *) b->theap->base)[p / 32] &= ~(1U << (p % 32));
}
static inline void
-mskSetVal(BAT *b, BUN p, msk v)
+mskSetVal(const BAT *b, BUN p, msk v)
{
if (v)
mskSet(b, p);
@@ -453,16 +453,19 @@ mskSetVal(BAT *b, BUN p, msk v)
mskClr(b, p);
}
+__attribute__((__pure__))
static inline msk
-mskGetVal(BAT *b, BUN p)
+mskGetVal(const BAT *b, BUN p)
{
return ((uint32_t *) b->theap->base)[p / 32] & (1U << (p % 32));
}
gdk_export gdk_return HEAPextend(Heap *h, size_t size, bool mayshare)
__attribute__((__warn_unused_result__));
-gdk_export size_t HEAPvmsize(Heap *h);
-gdk_export size_t HEAPmemsize(Heap *h);
+gdk_export size_t HEAPvmsize(const Heap *h)
+ __attribute__((__pure__));
+gdk_export size_t HEAPmemsize(const Heap *h)
+ __attribute__((__pure__));
gdk_export void HEAPdecref(Heap *h, bool remove);
gdk_export void HEAPincref(Heap *h);
diff --git a/gdk/gdk_heap.c b/gdk/gdk_heap.c
--- a/gdk/gdk_heap.c
+++ b/gdk/gdk_heap.c
@@ -900,7 +900,7 @@ HEAPsave(Heap *h, const char *nme, const
/* Return the (virtual) size of the heap. */
size_t
-HEAPvmsize(Heap *h)
+HEAPvmsize(const Heap *h)
{
if (h && h->base && h->free)
return h->size;
@@ -910,7 +910,7 @@ HEAPvmsize(Heap *h)
/* Return the allocated size of the heap, i.e. if the heap is memory
* mapped and not copy-on-write (privately mapped), return 0. */
size_t
-HEAPmemsize(Heap *h)
+HEAPmemsize(const Heap *h)
{
if (h && h->base && h->free && h->storage != STORE_MMAP)
return h->size;
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]