Changeset: 1668b00f3698 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=1668b00f3698
Modified Files:
        configure.ag
        gdk/gdk.h
        gdk/gdk_atoms.c
        gdk/gdk_col.c
        gdk/gdk_relop.c
        gdk/gdk_ssort.c
        gdk/gdk_ssort_impl.h
        gdk/gdk_storage.c
        gdk/gdk_system.h
        gdk/gdk_tm.c
        geom/monetdb5/geom.mx
        monetdb5/mal/mal_instruction.c
        monetdb5/mal/mal_interpreter.c
        monetdb5/mal/mal_type.c
        monetdb5/modules/mal/Makefile.ag
        monetdb5/modules/mal/Tests/bpm00.mal
        monetdb5/modules/mal/Tests/bpm00.stable.err
        monetdb5/modules/mal/Tests/bpm00.stable.out
        monetdb5/modules/mal/Tests/bpm01.mal
        monetdb5/modules/mal/Tests/bpm01.stable.err
        monetdb5/modules/mal/Tests/bpm01.stable.out
        monetdb5/modules/mal/Tests/bpm02.mal
        monetdb5/modules/mal/Tests/bpm02.stable.err
        monetdb5/modules/mal/Tests/bpm02.stable.out
        monetdb5/modules/mal/Tests/bpm05.mal
        monetdb5/modules/mal/Tests/bpm05.stable.err
        monetdb5/modules/mal/Tests/bpm05.stable.out
        monetdb5/modules/mal/Tests/bpm06.mal
        monetdb5/modules/mal/Tests/bpm06.stable.err
        monetdb5/modules/mal/Tests/bpm06.stable.out
        monetdb5/modules/mal/Tests/bpm06after.mal
        monetdb5/modules/mal/Tests/bpm06after.stable.err
        monetdb5/modules/mal/Tests/bpm06after.stable.out
        monetdb5/modules/mal/Tests/bpm08.mal
        monetdb5/modules/mal/Tests/bpm09.mal
        monetdb5/modules/mal/Tests/bpm10.mal
        monetdb5/modules/mal/Tests/bpm12.mal
        monetdb5/modules/mal/Tests/bpmUpdate.mal
        monetdb5/modules/mal/language.c
        monetdb5/modules/mal/mal_init.mal
        monetdb5/modules/mal/mat.c
        monetdb5/modules/mal/mdb.c
        monetdb5/modules/mal/remote.c
        monetdb5/modules/mal/remote.h
        monetdb5/modules/mal/tablet_sql.c
        monetdb5/optimizer/Makefile.ag
        monetdb5/optimizer/Tests/All
        monetdb5/optimizer/Tests/dataflow4.stable.err
        monetdb5/optimizer/Tests/dataflow4.stable.out
        monetdb5/optimizer/opt_dataflow.c
        monetdb5/optimizer/opt_mergetable.c
        monetdb5/optimizer/opt_prelude.c
        monetdb5/optimizer/opt_prelude.h
        monetdb5/optimizer/opt_slicing.mx
        monetdb5/optimizer/opt_support.c
        monetdb5/optimizer/opt_support.h
Branch: headless
Log Message:

Merge with default branch.


diffs (truncated from 6378 to 300 lines):

diff --git a/buildtools/Mx/MxFcnDef.h b/buildtools/Mx/MxFcnDef.h
--- a/buildtools/Mx/MxFcnDef.h
+++ b/buildtools/Mx/MxFcnDef.h
@@ -150,7 +150,7 @@
 extern void ofile_printf(_In_z_ _Printf_format_string_ const char *, ...)
        __attribute__((__format__(__printf__, 1, 2)));
 extern void Fatal(const char *, _In_z_ _Printf_format_string_ const char *, 
...)
-       __attribute__((__format__(__printf__, 2, 3)));
+       __attribute__((__format__(__printf__, 2, 3), __noreturn__));
 extern void Error(_In_z_ _Printf_format_string_ const char *, ...)
        __attribute__((__format__(__printf__, 1, 2)));
 extern void Message(_In_z_ _Printf_format_string_ const char *, ...)
diff --git a/clients/mapiclient/mclient.c b/clients/mapiclient/mclient.c
--- a/clients/mapiclient/mclient.c
+++ b/clients/mapiclient/mclient.c
@@ -2350,6 +2350,9 @@
        return errseen;
 }
 
+static void usage(const char *prog, int xit)
+       __attribute__((__noreturn__));
+
 static void
 usage(const char *prog, int xit)
 {
diff --git a/clients/mapiclient/mnc.c b/clients/mapiclient/mnc.c
--- a/clients/mapiclient/mnc.c
+++ b/clients/mapiclient/mnc.c
@@ -50,6 +50,9 @@
 #ifdef HAVE_NETDB_H
 # include <netdb.h>
 #endif
+#ifdef HAVE_NETINET_IN_H
+# include <netinet/in.h>
+#endif
 
 #ifndef HAVE_GETOPT_LONG
 # include "monet_getopt.h"
diff --git a/clients/mapiclient/msqldump.c b/clients/mapiclient/msqldump.c
--- a/clients/mapiclient/msqldump.c
+++ b/clients/mapiclient/msqldump.c
@@ -50,6 +50,9 @@
 #include "msqldump.h"
 #include "mprompt.h"
 
+static void usage(const char *prog, int xit)
+       __attribute__((__noreturn__));
+
 static void
 usage(const char *prog, int xit)
 {
diff --git a/clients/mapilib/mapi.c b/clients/mapilib/mapi.c
--- a/clients/mapilib/mapi.c
+++ b/clients/mapilib/mapi.c
@@ -2469,11 +2469,9 @@
                        if (mid->password[0] != '\1') {
                                unsigned char md[64];   /* should be 
SHA512_DIGEST_LENGTH */
                                size_t n = strlen(mid->password);
-                               char *key = alloca(n);
+                               char *key = mid->password;
                                int len;
 
-                               strncpy(key, mid->password, n);
-
 #ifdef HAVE_RIPEMD160
                                if (strcmp(serverhash, "RIPEMD160") == 0) {
                                        RIPEMD160((unsigned char *) key, n, md);
diff --git a/common/stream/stream.c b/common/stream/stream.c
--- a/common/stream/stream.c
+++ b/common/stream/stream.c
@@ -1854,12 +1854,17 @@
        struct icstream *ic = (struct icstream *) s->stream_data.p;
        ICONV_CONST char *inbuf = (ICONV_CONST char *) buf;
        size_t inbytesleft = elmsize * cnt;
+       char *bf = NULL;
 
        /* if unconverted data from a previous call remains, add it to
           the start of the new data, using temporary space */
        if (ic->buflen > 0) {
-               char *bf = alloca(ic->buflen + inbytesleft);
-
+               bf = malloc(ic->buflen + inbytesleft);
+               if (bf == NULL) {
+                       /* cannot allocate memory */
+                       s->errnr = MNSTR_WRITE_ERROR;
+                       return -1;
+               }
                memcpy(bf, ic->buffer, ic->buflen);
                memcpy(bf + ic->buflen, buf, inbytesleft);
                buf = bf;
@@ -1875,6 +1880,8 @@
                        case EILSEQ:
                                /* invalid multibyte sequence encountered */
                                s->errnr = MNSTR_WRITE_ERROR;
+                               if (bf)
+                                       free(bf);
                                return -1;
                        case EINVAL:
                                /* incomplete multibyte sequence encountered */
@@ -1885,10 +1892,14 @@
                                if (inbytesleft > sizeof(ic->buffer)) {
                                        /* ridiculously long multibyte 
sequence, so return error */
                                        s->errnr = MNSTR_WRITE_ERROR;
+                                       if (bf)
+                                               free(bf);
                                        return -1;
                                }
                                memcpy(ic->buffer, inbuf, inbytesleft);
                                ic->buflen = inbytesleft;
+                               if (bf)
+                                       free(bf);
                                return (ssize_t) cnt;
                        case E2BIG:
                                /* not enough space in output buffer */
@@ -1896,11 +1907,15 @@
                        default:
                                /* cannot happen (according to manual) */
                                s->errnr = MNSTR_WRITE_ERROR;
+                               if (bf)
+                                       free(bf);
                                return -1;
                        }
                }
                mnstr_write(ic->s, ic->buffer, 1, sizeof(ic->buffer) - 
outbytesleft);
        }
+       if (bf)
+               free(bf);
        return (ssize_t) cnt;
 }
 
diff --git a/configure.ag b/configure.ag
--- a/configure.ag
+++ b/configure.ag
@@ -161,21 +161,21 @@
 dft_rdf=no
 AC_ARG_ENABLE(rdf,
        AS_HELP_STRING([--enable-rdf],
-               [enable support for RDF (default=no)]),
+               [enable support for RDF [experimental/unsupported] 
(default=no)]),
        enable_rdf=$enableval,
        enable_rdf=$dft_rdf)
 
 dft_crackers=no
 AC_ARG_ENABLE(crackers,
        AS_HELP_STRING([--enable-crackers],
-               [enable database cracking components (default=no)]),
+               [enable database cracking components [experimental/unsupported] 
(default=no)]),
        enable_crackers=$enableval,
        enable_crackers=$dft_crackers)
 
 dft_datacell=no
 AC_ARG_ENABLE(datacell,
        AS_HELP_STRING([--enable-datacell],
-               [enable datacell stream components (default=no)]),
+               [enable datacell stream components [experimental/unsupported] 
(default=no)]),
        enable_datacell=$enableval,
        enable_datacell=$dft_datacell)
 
@@ -2377,6 +2377,7 @@
        mach-o/dyld.h \
        malloc.h \
        netdb.h \
+       netinet/in.h \
        procfs.h \
        pwd.h \
        regex.h \
diff --git a/debian/monetdb5-sql.install b/debian/monetdb5-sql.install
--- a/debian/monetdb5-sql.install
+++ b/debian/monetdb5-sql.install
@@ -20,4 +20,5 @@
 debian/tmp/usr/lib/monetdb5/createdb/23_skyserver.sql usr/lib/monetdb5/createdb
 debian/tmp/usr/lib/monetdb5/createdb/24_zorder.sql usr/lib/monetdb5/createdb
 debian/tmp/usr/lib/monetdb5/createdb/25_debug.sql usr/lib/monetdb5/createdb
+debian/tmp/usr/lib/monetdb5/createdb/80_udf.sql usr/lib/monetdb5/createdb
 debian/tmp/usr/lib/monetdb5/createdb/99_system.sql usr/lib/monetdb5/createdb
diff --git a/gdk/gdk_atoms.c b/gdk/gdk_atoms.c
--- a/gdk/gdk_atoms.c
+++ b/gdk/gdk_atoms.c
@@ -795,11 +795,12 @@
        t = r;
        while ((c = *t) && (c == '_' || GDKisalnum(c)))
                t++;
-       s = (char *) alloca((unsigned) (1 + t - r));
+       s = GDKmalloc((unsigned) (1 + t - r));
        if (s != NULL) {
                strncpy(s, r, t - r);
                s[t - r] = 0;
                bid = CBPindex(s);
+               GDKfree(s);
        }
        **dst = bid == 0 ? bat_nil : bid;
        return (int) (t + (c == '>') - src);
diff --git a/gdk/gdk_col.c b/gdk/gdk_col.c
--- a/gdk/gdk_col.c
+++ b/gdk/gdk_col.c
@@ -1126,20 +1126,23 @@
                                b->seqbase++;
                        }
                } else {
-                       unsigned short hs = b->width;
-                       char *htmp = alloca(hs);
+                       char tmp[16];
+                       /* avoid compiler warning: dereferencing type-punned 
pointer
+                        * will break strict-aliasing rules */
+                       char *tmpp = tmp;
 
+                       assert(hs <= 16);
                        l = b->first;
                        if (b->hash) {
                                HASHmove(b->hash, l, p, BUNhead(bi, l), l < 
last);
                        }
 
                        /* move first to tmp */
-                       un_move(COLelement(b, l), htmp, hs);
+                       un_move(COLelement(b, l), tmpp, hs);
                        /* move delete to first */
                        un_move(COLelement(b, p), COLelement(b, l), hs);
                        /* move first to deleted */
-                       un_move(htmp, COLelement(b, p), hs);
+                       un_move(tmpp, COLelement(b, p), hs);
 
                        if (b->sorted) {
                                b->sorted = FALSE;
@@ -1177,19 +1180,23 @@
                }
                if (p != last) {
                        unsigned short hs = b->width;
-                       char *htmp = alloca(hs);
+                       char tmp[16];
+                       /* avoid compiler warning: dereferencing type-punned 
pointer
+                        * will break strict-aliasing rules */
+                       char *tmpp = tmp;
                        COLiter bi2 = col_iterator(b);
 
+                       assert(hs <= 16);
                        if (b->hash) {
                                HASHmove(b->hash, last, p, BUNhead(bi, last), 
last < last);
                        }
 
                        /* move first to tmp */
-                       un_move(COLelement(b, last), htmp, hs);
+                       un_move(COLelement(b, last), tmpp, hs);
                        /* move delete to first */
                        un_move(COLelement(b, p), COLelement(b, last), hs);
                        /* move first to deleted */
-                       un_move(htmp, COLelement(b, p), hs);
+                       un_move(tmpp, COLelement(b, p), hs);
 
                        /* If a column was sorted before the oid was
                           deleted, check whether it is still sorted
diff --git a/gdk/gdk_relop.c b/gdk/gdk_relop.c
--- a/gdk/gdk_relop.c
+++ b/gdk/gdk_relop.c
@@ -134,13 +134,17 @@
                        
                        step = l->count / (slices -= SAMPLE_TRESHOLD_LOG);
                        sample = slices * SAMPLE_SLICE_SIZE;
-                       cnt = (oid *) alloca(slices * sizeof(oid));
+                       cnt = (oid *) GDKmalloc(slices * sizeof(oid));
+                       if (cnt == NULL)
+                               return GDK_FAIL;
                        for (lo = 0; idx < slices; lo += step) {
                                oid size = 0, hi = lo + SAMPLE_SLICE_SIZE;
                                
                                tmp1 = COLslice(l, lo, hi);     /* slice keeps 
all parent properties */
-                               if (tmp1 == NULL)
+                               if (tmp1 == NULL) {
+                                       GDKfree(cnt);
                                        return GDK_FAIL;
+                               }
                                tmp2 = tmp3 = NULL;
                                if (COLjoin_impl(&tmp2, &tmp3, tmp1, r, 
BUN_NONE, op, anti, outer) == 0) {
                                        size = tmp2->count;
@@ -175,9 +179,12 @@
                                        }
                                        CBPreclaim(tmp1);
                                }
-                               if (tmp3 == NULL)
+                               if (tmp3 == NULL) {
+                                       GDKfree(cnt);
                                        return GDK_FAIL;
+                               }
                        }
+                       GDKfree(cnt);
                        /* overestimate always by 5% */
                        {
                                double d = (double) (((lng) tot) * ((lng) 
l->count)) / (0.95 * (double) sample);
diff --git a/gdk/gdk_ssort.c b/gdk/gdk_ssort.c
--- a/gdk/gdk_ssort.c
+++ b/gdk/gdk_ssort.c
@@ -62,7 +62,7 @@
           most 2 lng's, we don't need to allocate anything. */
        void *th;
        void *tt;
-       char tempstorageh[sizeof(lng)];
+       char tempstorageh[16];  /* 16 bytes should be wide enough */
        char tempstoraget[sizeof(oid)];
 
        /* This controls when we get *into* galloping mode.  It's
diff --git a/gdk/gdk_ssort_impl.h b/gdk/gdk_ssort_impl.h
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to