Changeset: 98270f7a2d48 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/98270f7a2d48 Modified Files: clients/mapiclient/mclient.c clients/mapilib/mapi.c gdk/gdk.h gdk/gdk_aggr.c monetdb5/extras/rapi/rapi.c sql/backends/monet5/sql.c Branch: Jul2021 Log Message:
Merge with Oct2020 branch. diffs (102 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) /* @@ -3469,11 +3469,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; \ } \ } \ @@ -3609,11 +3609,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; } @@ -3626,11 +3626,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_aggr.c b/gdk/gdk_aggr.c --- a/gdk/gdk_aggr.c +++ b/gdk/gdk_aggr.c @@ -3939,8 +3939,8 @@ BATmax(BAT *b, void *aggr) #define DO_QUANTILE_AVG(TPE) \ do { \ - TPE low = *(TPE*) BUNtail(bi, r + (BUN) hi); \ - TPE high = *(TPE*) BUNtail(bi, r + (BUN) lo); \ + TPE low = *(TPE*) BUNtloc(bi, r + (BUN) hi); \ + TPE high = *(TPE*) BUNtloc(bi, r + (BUN) lo); \ if (is_##TPE##_nil(low) || is_##TPE##_nil(high)) { \ val = dbl_nil; \ nils++; \ diff --git a/sql/backends/monet5/sql.c b/sql/backends/monet5/sql.c --- a/sql/backends/monet5/sql.c +++ b/sql/backends/monet5/sql.c @@ -965,7 +965,7 @@ mvc_bat_next_get_value(Client cntxt, Mal sql_schema *s = NULL; sql_sequence *seq = NULL; seqbulk *sb = NULL; - BATiter bi = (BATiter) { .b = NULL }, ci = (BATiter) { .b = NULL }; + BATiter bi, ci; bat *res = getArgReference_bat(stk, pci, 0); bat schid = 0, seqid = 0; _______________________________________________ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org