Changeset: a68879af1230 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/a68879af1230 Modified Files: clients/mapiclient/mclient.c clients/mapilib/mapi.c gdk/gdk.h gdk/gdk_aggr.c gdk/gdk_bat.c gdk/gdk_batop.c monetdb5/extras/rapi/rapi.c sql/backends/monet5/sql.c Branch: Jan2022 Log Message:
Merge with Jul2021 branch. diffs (125 lines): diff --git a/clients/mapilib/mapi.c b/clients/mapilib/mapi.c --- a/clients/mapilib/mapi.c +++ b/clients/mapilib/mapi.c @@ -1046,15 +1046,15 @@ static ATOMIC_FLAG mapi_initialized = AT return (e); \ } \ } while (0) -#define REALLOC(p, c) \ - do { \ - if (p) { \ - void *tmp = (p); \ - (p) = realloc((p), (c) * sizeof(*(p))); \ - if ((p) == NULL) \ - free(tmp); \ - } else \ - (p) = malloc((c) * sizeof(*(p))); \ +#define REALLOC(p, c) \ + do { \ + if (p) { \ + void *tmp = realloc((p), (c) * sizeof(*(p))); \ + if (tmp == NULL) \ + free(p); \ + (p) = tmp; \ + } else \ + (p) = malloc((c) * sizeof(*(p))); \ } while (0) /* @@ -3443,11 +3443,11 @@ mapi_prepare(Mapi mid, const char *cmd) do { \ /* note: k==strlen(hdl->query) */ \ if (k+len >= lim) { \ - char *q = hdl->query; \ lim = k + len + MAPIBLKSIZE; \ - hdl->query = realloc(hdl->query, lim); \ - if (hdl->query == NULL) { \ - free(q); \ + char *q = realloc(hdl->query, lim); \ + if (q == NULL) { \ + free(hdl->query); \ + hdl->query = NULL; \ return; \ } \ } \ @@ -3583,11 +3583,11 @@ mapi_param_store(MapiHdl hdl) val = mapi_quote(buf, 1); /* note: k==strlen(hdl->query) */ if (k + strlen(val) + 3 >= lim) { - char *q = hdl->query; lim = k + strlen(val) + 3 + MAPIBLKSIZE; - hdl->query = realloc(hdl->query, lim); - if (hdl->query == NULL) { - free(q); + char *q = realloc(hdl->query, lim); + if (q == NULL) { + free(hdl->query); + hdl->query = NULL; free(val); return; } @@ -3599,11 +3599,11 @@ mapi_param_store(MapiHdl hdl) val = mapi_quote((char *) src, hdl->params[i].sizeptr ? *hdl->params[i].sizeptr : -1); /* note: k==strlen(hdl->query) */ if (k + strlen(val) + 3 >= lim) { - char *q = hdl->query; lim = k + strlen(val) + 3 + MAPIBLKSIZE; - hdl->query = realloc(hdl->query, lim); - if (hdl->query == NULL) { - free(q); + char *q = realloc(hdl->query, lim); + if (q == NULL) { + free(hdl->query); + hdl->query = NULL; free(val); return; } diff --git a/gdk/gdk.h b/gdk/gdk.h --- a/gdk/gdk.h +++ b/gdk/gdk.h @@ -1153,10 +1153,11 @@ typedef var_t stridx_t; #define BUNtvaroff(bi,p) VarHeapVal((bi).base, (p), (bi).width) -#define BUNtloc(bi,p) (ATOMstorage((bi).type) == TYPE_msk ? Tmsk(&(bi), p) : (void *) ((char *) (bi).base + ((p) << (bi).shift))) +#define BUNtmsk(bi,p) Tmsk(&(bi), (p)) +#define BUNtloc(bi,p) (assert((bi).type != TYPE_msk), ((void *) ((char *) (bi).base + ((p) << (bi).shift)))) #define BUNtpos(bi,p) Tpos(&(bi),p) #define BUNtvar(bi,p) (assert((bi).type && (bi).b->tvarsized), (void *) ((bi).vh->base+BUNtvaroff(bi,p))) -#define BUNtail(bi,p) ((bi).type?(bi).b->tvarsized?BUNtvar(bi,p):BUNtloc(bi,p):BUNtpos(bi,p)) +#define BUNtail(bi,p) ((bi).type?(bi).b->tvarsized?BUNtvar(bi,p):(bi).type==TYPE_msk?BUNtmsk(bi,p):BUNtloc(bi,p):BUNtpos(bi,p)) #define BUNlast(b) (assert((b)->batCount <= BUN_MAX), (b)->batCount) @@ -1965,6 +1966,7 @@ Tpos(BATiter *bi, BUN p) static inline bool Tmskval(BATiter *bi, BUN p) { + assert(ATOMstorage(bi->type) == TYPE_msk); return ((uint32_t *) bi->base)[p / 32] & (1U << (p % 32)); } diff --git a/gdk/gdk_bat.c b/gdk/gdk_bat.c --- a/gdk/gdk_bat.c +++ b/gdk/gdk_bat.c @@ -1433,6 +1433,8 @@ BUNinplacemulti(BAT *b, const oid *posit } else { val = BUNtpos(bi, p); } + } else if (bi.type == TYPE_msk) { + val = BUNtmsk(bi, p); } else { val = BUNtloc(bi, p); } diff --git a/gdk/gdk_batop.c b/gdk/gdk_batop.c --- a/gdk/gdk_batop.c +++ b/gdk/gdk_batop.c @@ -1363,7 +1363,7 @@ BATappend_or_update(BAT *b, BAT *p, cons bat_iterator_end(&ni); return GDK_FAIL; } - if (BUNappend(b, Tmsk(&ni, i), force) != GDK_SUCCEED) { + if (BUNappend(b, BUNtmsk(ni, i), force) != GDK_SUCCEED) { bat_iterator_end(&ni); return GDK_FAIL; } _______________________________________________ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org