Changeset: 10a95fa017b8 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/10a95fa017b8
Modified Files:
        clients/mapiclient/mclient.c
        clients/mapilib/mapi.c
        configure.ag
        gdk/gdk.h
        gdk/gdk_aggr.c
        monetdb5/extras/rapi/rapi.c
        sql/backends/monet5/sql.c
        sql/server/Makefile.ag
Branch: Jun2020
Log Message:

Merge with Nov2019 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
@@ -1010,15 +1010,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)
 
 /*
@@ -3377,11 +3377,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;                         \
                        }                                       \
                        hdl->query = q;                         \
@@ -3518,11 +3518,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;
                                        }
@@ -3535,11 +3535,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
@@ -2763,8 +2763,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
@@ -160,10 +160,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
@@ -870,10 +870,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;
@@ -1052,10 +1050,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

Reply via email to