Changeset: 2ea2b24036ad for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=2ea2b24036ad
Modified Files:
gdk/gdk_atoms.c
gdk/gdk_bat.c
gdk/gdk_bbp.c
gdk/gdk_hash.c
gdk/gdk_heap.c
gdk/gdk_imprints.c
gdk/gdk_join.c
gdk/gdk_orderidx.c
gdk/gdk_private.h
gdk/gdk_storage.c
gdk/gdk_tm.c
Branch: default
Log Message:
A bunch of internal type changes, mostly int -> bool.
diffs (truncated from 1286 to 300 lines):
diff --git a/gdk/gdk_atoms.c b/gdk/gdk_atoms.c
--- a/gdk/gdk_atoms.c
+++ b/gdk/gdk_atoms.c
@@ -221,7 +221,7 @@ ATOMname(int t)
return t >= 0 && t < GDKatomcnt && *BATatoms[t].name ? BATatoms[t].name
: "null";
}
-int
+bool
ATOMisdescendant(int tpe, int parent)
{
int cur = -1;
@@ -229,10 +229,10 @@ ATOMisdescendant(int tpe, int parent)
while (cur != tpe) {
cur = tpe;
if (cur == parent)
- return TRUE;
+ return true;
tpe = ATOMstorage(tpe);
}
- return FALSE;
+ return false;
}
diff --git a/gdk/gdk_bat.c b/gdk/gdk_bat.c
--- a/gdk/gdk_bat.c
+++ b/gdk/gdk_bat.c
@@ -53,7 +53,7 @@
static char *BATstring_h = "h";
static char *BATstring_t = "t";
-static inline int
+static inline bool
default_ident(char *s)
{
return (s == BATstring_h || s == BATstring_t);
@@ -630,7 +630,7 @@ heapmove(Heap *dst, Heap *src)
*dst = *src;
}
-static int
+static bool
wrongtype(int t1, int t2)
{
/* check if types are compatible. be extremely forgiving */
@@ -643,10 +643,10 @@ wrongtype(int t1, int t2)
ATOMsize(t1) != ATOMsize(t2) ||
BATatoms[t1].atomFix ||
BATatoms[t2].atomFix)
- return TRUE;
+ return true;
}
}
- return FALSE;
+ return false;
}
/*
@@ -888,7 +888,7 @@ COLcopy(BAT *b, int tt, int writable, in
static void
setcolprops(BAT *b, const void *x)
{
- int isnil = b->ttype != TYPE_void &&
+ bool isnil = b->ttype != TYPE_void &&
ATOMcmp(b->ttype, x, ATOMnilptr(b->ttype)) == 0;
BATiter bi;
BUN pos;
@@ -1671,7 +1671,7 @@ backup_new(Heap *hp, int lockbat)
/* transition heap from readonly to writable */
static storage_t
-HEAPchangeaccess(Heap *hp, int dstmode, int existing)
+HEAPchangeaccess(Heap *hp, int dstmode, bool existing)
{
if (hp->base == NULL || hp->newstorage == STORE_MEM || !existing ||
dstmode == -1)
return hp->newstorage; /* 0<=>2,1<=>3,a<=>b */
@@ -1690,7 +1690,7 @@ HEAPchangeaccess(Heap *hp, int dstmode,
/* heap changes persistence mode (at commit point) */
static storage_t
-HEAPcommitpersistence(Heap *hp, int writable, int existing)
+HEAPcommitpersistence(Heap *hp, bool writable, bool existing)
{
if (existing) { /* existing, ie will become transient */
if (hp->storage == STORE_MMAP && hp->newstorage == STORE_PRIV
&& writable) { /* 6=>2 */
@@ -1713,11 +1713,11 @@ HEAPcommitpersistence(Heap *hp, int writ
/* change the heap modes at a commit */
gdk_return
-BATcheckmodes(BAT *b, int existing)
+BATcheckmodes(BAT *b, bool existing)
{
- int wr = (b->batRestricted == BAT_WRITE);
+ bool wr = (b->batRestricted == BAT_WRITE);
storage_t m1 = STORE_MEM, m3 = STORE_MEM;
- int dirty = 0;
+ bool dirty = false;
BATcheck(b, "BATcheckmodes", GDK_FAIL);
@@ -1727,7 +1727,7 @@ BATcheckmodes(BAT *b, int existing)
}
if (b->tvheap) {
- int ta = (b->batRestricted == BAT_APPEND) &&
ATOMappendpriv(b->ttype, b->tvheap);
+ bool ta = (b->batRestricted == BAT_APPEND) &&
ATOMappendpriv(b->ttype, b->tvheap);
m3 = HEAPcommitpersistence(b->tvheap, wr || ta, existing);
dirty |= (b->tvheap->newstorage != m3);
}
@@ -1755,9 +1755,9 @@ BATsetaccess(BAT *b, int newmode)
bakmode = b->batRestricted;
bakdirty = b->batDirtydesc;
if (bakmode != newmode || (b->batSharecnt && newmode != BAT_READ)) {
- int existing = BBP_status(b->batCacheid) & BBPEXISTING;
- int wr = (newmode == BAT_WRITE);
- int rd = (bakmode == BAT_WRITE);
+ bool existing = (BBP_status(b->batCacheid) & BBPEXISTING) != 0;
+ bool wr = (newmode == BAT_WRITE);
+ bool rd = (bakmode == BAT_WRITE);
storage_t m1, m3 = STORE_MEM;
storage_t b1, b3 = STORE_MEM;
@@ -1771,7 +1771,7 @@ BATsetaccess(BAT *b, int newmode)
b1 = b->theap.newstorage;
m1 = HEAPchangeaccess(&b->theap, ACCESSMODE(wr, rd), existing);
if (b->tvheap) {
- int ta = (newmode == BAT_APPEND &&
ATOMappendpriv(b->ttype, b->tvheap));
+ bool ta = (newmode == BAT_APPEND &&
ATOMappendpriv(b->ttype, b->tvheap));
b3 = b->tvheap->newstorage;
m3 = HEAPchangeaccess(b->tvheap, ACCESSMODE(wr && ta,
rd && ta), existing);
}
@@ -1960,7 +1960,7 @@ BATassertProps(BAT *b)
int (*cmpf)(const void *, const void *);
int cmp;
const void *prev = NULL, *valp, *nilp;
- int seennil = 0;
+ bool seennil = false;
/* general BAT sanity */
assert(b != NULL);
@@ -2113,7 +2113,7 @@ BATassertProps(BAT *b)
/* we found a nil:
* we're done checking
* for them */
- seennil = 1;
+ seennil = true;
cmpnil = 0;
if (!cmpprv) {
/* we were
@@ -2175,7 +2175,7 @@ BATassertProps(BAT *b)
cmp = cmpf(valp, nilp);
assert(!b->tnonil || cmp != 0);
if (cmp == 0)
- seennil = 1;
+ seennil = true;
}
HEAPfree(&hs->heap, 1);
GDKfree(hs);
diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c
--- a/gdk/gdk_bbp.c
+++ b/gdk/gdk_bbp.c
@@ -114,16 +114,16 @@ bat BBP_mask = 0; /* number of buckets
static void BBPspin(bat bid, const char *debug, int event);
static gdk_return BBPfree(BAT *b, const char *calledFrom);
static void BBPdestroy(BAT *b);
-static void BBPuncacheit(bat bid, int unloaddesc);
-static gdk_return BBPprepare(bit subcommit);
-static BAT *getBBPdescriptor(bat i, int lock);
-static gdk_return BBPbackup(BAT *b, bit subcommit);
+static void BBPuncacheit(bat bid, bool unloaddesc);
+static gdk_return BBPprepare(bool subcommit);
+static BAT *getBBPdescriptor(bat i, bool lock);
+static gdk_return BBPbackup(BAT *b, bool subcommit);
static gdk_return BBPdir(int cnt, bat *subcommit);
#ifdef HAVE_HGE
/* start out by saying we have no hge, but as soon as we've seen one,
* we'll always say we do have it */
-static int havehge = 0;
+static bool havehge = false;
#endif
#define BBPnamecheck(s) (BBPtmpcheck(s) ? strtol((s) + 4, NULL, 8) : 0)
@@ -346,7 +346,7 @@ BBPselectfarm(int role, int type, enum h
* locks are held and it will allocate memory.
*/
static gdk_return
-BBPextend(int idx, int buildhash)
+BBPextend(int idx, bool buildhash)
{
if ((bat) ATOMIC_GET(BBPsize, BBPsizeLock) >= N_BBPINIT * BBPINIT) {
GDKerror("BBPextend: trying to extend BAT pool beyond the "
@@ -379,7 +379,7 @@ BBPextend(int idx, int buildhash)
}
static gdk_return
-recover_dir(int farmid, int direxists)
+recover_dir(int farmid, bool direxists)
{
if (direxists) {
/* just try; don't care about these non-vital files */
@@ -393,7 +393,7 @@ recover_dir(int farmid, int direxists)
static gdk_return BBPrecover(int farmid);
static gdk_return BBPrecover_subdir(void);
-static int BBPdiskscan(const char *, size_t);
+static bool BBPdiskscan(const char *, size_t);
#ifdef GDKLIBRARY_SORTEDPOS
static void
@@ -403,13 +403,13 @@ fixsorted(void)
BAT *b;
BATiter bi;
int dbg = GDKdebug;
- int loaded;
+ bool loaded;
GDKdebug &= ~(CHECKMASK | PROPMASK);
for (bid = 1; bid < (bat) ATOMIC_GET(BBPsize, BBPsizeLock); bid++) {
if ((b = BBP_desc(bid)) == NULL)
continue; /* not a valid BAT */
- loaded = 0;
+ loaded = false;
if (b->tnosorted != 0) {
if (b->tsorted) {
/* position should not be set */
@@ -433,7 +433,7 @@ fixsorted(void)
if (b == NULL)
b = BBP_desc(bid);
else
- loaded = 1;
+ loaded = true;
}
if (!loaded ||
ATOMcmp(b->ttype,
@@ -473,7 +473,7 @@ fixsorted(void)
if (b == NULL)
b = BBP_desc(bid);
else
- loaded = 1;
+ loaded = true;
}
if (!loaded ||
ATOMcmp(b->ttype,
@@ -625,7 +625,7 @@ fixwkbheap(void)
* fixes the affected bats.
* Note that we only fix BATs whose string heap is still fully double
* eliminated. */
-static inline int
+static inline bool
offsearch(const int *restrict offsets, int noffsets, int val)
{
/* binary search on offsets for val, return whether present */
@@ -659,7 +659,7 @@ fixstroffheap(BAT *b, int *restrict offs
char *srcdir;
BUN i;
int width;
- int nofix = 1;
+ bool nofix = true;
assert(GDK_ELIMDOUBLES(b->tvheap));
@@ -766,7 +766,7 @@ fixstroffheap(BAT *b, int *restrict offs
pos = (var_t) ((unsigned char *) h1.base)[i] +
GDK_VAROFFSET;
if (!offsearch(offsets, noffsets, (int) pos)) {
pos = emptyoff;
- nofix = 0;
+ nofix = false;
}
if (width == 1)
((unsigned char *) h3.base)[i] = (unsigned
char) (pos - GDK_VAROFFSET);
@@ -779,7 +779,7 @@ fixstroffheap(BAT *b, int *restrict offs
pos = (var_t) ((unsigned short *) h1.base)[i] +
GDK_VAROFFSET;
if (!offsearch(offsets, noffsets, (int) pos)) {
pos = emptyoff;
- nofix = 0;
+ nofix = false;
}
if (width == 2)
((unsigned short *) h3.base)[i] = (unsigned
short) (pos - GDK_VAROFFSET);
@@ -792,7 +792,7 @@ fixstroffheap(BAT *b, int *restrict offs
pos = (var_t) ((unsigned int *) h1.base)[i];
if (!offsearch(offsets, noffsets, (int) pos)) {
pos = emptyoff;
- nofix = 0;
+ nofix = false;
}
((unsigned int *) h3.base)[i] = (unsigned int) pos;
}
@@ -803,7 +803,7 @@ fixstroffheap(BAT *b, int *restrict offs
pos = (var_t) ((ulng *) h1.base)[i];
if (!offsearch(offsets, noffsets, (int) pos)) {
pos = emptyoff;
- nofix = 0;
+ nofix = false;
}
((ulng *) h3.base)[i] = (ulng) pos;
}
@@ -908,7 +908,7 @@ fixfltheap(BAT *b)
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list