Changeset: ceaa337f8fef for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/ceaa337f8fef 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: Oct2020 Log Message:
Merge with Jun2020 branch. diffs (135 lines): diff --git a/clients/mapilib/mapi.c b/clients/mapilib/mapi.c --- a/clients/mapilib/mapi.c +++ b/clients/mapilib/mapi.c @@ -1011,15 +1011,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) /* @@ -3351,11 +3351,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; \ } \ } \ @@ -3491,11 +3491,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; } @@ -3508,11 +3508,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 @@ -3669,8 +3669,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/monetdb5/extras/rapi/rapi.c b/monetdb5/extras/rapi/rapi.c --- a/monetdb5/extras/rapi/rapi.c +++ b/monetdb5/extras/rapi/rapi.c @@ -467,10 +467,12 @@ static char *RAPIinitialize(void) { if ((e = RAPIinstalladdons()) != 0) { return e; } +#if R_VERSION < R_Version(4,2,0) // patch R internals to disallow quit and system. Setting them to NULL produces an error. SET_INTERNAL(install("quit"), R_NilValue); // install.packages() uses system2 to call gcc etc., so we cannot disable it (perhaps store the pointer somewhere just for that?) //SET_INTERNAL(install("system"), R_NilValue); +#endif rapiInitialized = true; return NULL; 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 @@ -854,10 +854,8 @@ mvc_bat_next_get_value(Client cntxt, Mal if (!BATcount(it)) goto bailout; /* Success case */ - if (b) - bi = bat_iterator(b); - if (c) - ci = bat_iterator(c); + bi = bat_iterator(b); + ci = bat_iterator(c); BATloop(it, p, q) { str nsname, nseqname; @@ -1036,10 +1034,8 @@ mvc_bat_restart_seq(Client cntxt, MalBlk if (!BATcount(it)) goto bailout; /* Success case */ - if (b) - bi = bat_iterator(b); - if (c) - ci = bat_iterator(c); + bi = bat_iterator(b); + ci = bat_iterator(c); if (d) di = (lng *) Tloc(d, 0); _______________________________________________ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org