Changeset: 3cc9b8a40a08 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=3cc9b8a40a08 Modified Files: configure.ag monetdb5/modules/mal/Makefile.ag monetdb5/modules/mal/bpm.mx monetdb5/modules/mal/mal_init.mx monetdb5/optimizer/opt_dataflow.mx monetdb5/optimizer/opt_mergetable.mx sql/backends/monet5/UDF/Makefile.ag sql/backends/monet5/datacell/actuator.c sql/backends/monet5/datacell/petrinet.c sql/backends/monet5/datacell/sensor.c Branch: default Log Message:
Merge with Aug2011 branch. diffs (truncated from 3855 to 300 lines): 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/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/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.mx b/gdk/gdk.mx --- a/gdk/gdk.mx +++ b/gdk/gdk.mx @@ -401,10 +401,6 @@ #endif #endif -#ifdef __cplusplus -extern "C" { -#endif - #include "gdk_system.h" #include "gdk_posix.h" #include <stream.h> @@ -2621,9 +2617,6 @@ #define THRset_errbuf(t,b) (t->data[2] = b) #ifndef GDK_NOLINK -#ifdef __cplusplus -extern "C" { -#endif static inline bat BBPcheck(register bat x, register const char *y) @@ -2680,9 +2673,6 @@ return BBP_cache(-b->batCacheid); } -#ifdef __cplusplus -} -#endif #endif /* @@ -3422,10 +3412,6 @@ typedef void (*ColFcn) (ptr, ptr); typedef void (*RowFcn) (ptr, ptr *); - -#ifdef __cplusplus -} -#endif @ @h diff --git a/gdk/gdk_atoms.mx b/gdk/gdk_atoms.mx --- a/gdk/gdk_atoms.mx +++ b/gdk/gdk_atoms.mx @@ -89,9 +89,6 @@ This leads to the following type descriptor table. @h -#ifdef __cplusplus -extern "C" { -#endif gdk_export int lngFromStr(str src, int *len, lng **dst); gdk_export int lngToStr(str *dst, int *len, lng *src); gdk_export int intFromStr(str src, int *len, int **dst); @@ -122,9 +119,6 @@ gdk_export int strNil(const char *s); gdk_export int escapedStrlen(const char *src); gdk_export int escapedStr(char *dst, const char *src, int dstlen); -#ifdef __cplusplus -} -#endif @- inline comparison routines Return 0 on l==r, < 0 iff l < r, >0 iff l > r @c @@ -1358,11 +1352,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 = BBPindex(s); + GDKfree(s); } **dst = bid == 0 ? bat_nil : bid; return (int) (t + (c == '>') - src); diff --git a/gdk/gdk_bat.mx b/gdk/gdk_bat.mx --- a/gdk/gdk_bat.mx +++ b/gdk/gdk_bat.mx @@ -1070,9 +1070,13 @@ } @= acc_move { - char *htmp = alloca(hs); - char *ttmp = alloca(ts); - + char tmp[16]; + /* avoid compiler warning: dereferencing type-punned pointer + * will break strict-aliasing rules */ + char *tmpp = tmp; + + assert(hs <= 16); + assert(ts <= 16); if (b->H->hash) { HASHmove(b->H->hash, @3, @4, BUNhead(bi, @1), @1 < last); } @@ -1081,15 +1085,18 @@ } /* move first to tmp */ - @:un_move(Hloc(b,@1),htmp,hs)@ - @:un_move(Tloc(b,@1),ttmp,ts)@ + @:un_move(Hloc(b,@1),tmpp,hs)@ /* move delete to first */ @:un_move(Hloc(b,@2),Hloc(b,@1),hs)@ + /* move first to deleted */ + @:un_move(tmpp,Hloc(b,@2),hs)@ + + /* move first to tmp */ + @:un_move(Tloc(b,@1),tmpp,ts)@ + /* move delete to first */ @:un_move(Tloc(b,@2),Tloc(b,@1),ts)@ /* move first to deleted */ - @:un_move(htmp,Hloc(b,@2),hs)@ - @:un_move(ttmp,Tloc(b,@2),ts)@ - + @:un_move(tmpp,Tloc(b,@2),ts)@ } @- BUN Insertion diff --git a/gdk/gdk_relop.mx b/gdk/gdk_relop.mx --- a/gdk/gdk_relop.mx +++ b/gdk/gdk_relop.mx @@ -84,19 +84,24 @@ _slices++; } if (_slices > SAMPLE_TRESHOLD_LOG) { - /* use cheapo sampling by taking a number of slices and joining those with the algo */ + /* use cheapo sampling by taking a number of + * slices and joining those with the algo */ BUN _idx = 0, _tot = 0, _step, _lo, _avg, _sample, *_cnt; BAT *_tmp1 = l, *_tmp2, *_tmp3 = NULL; _step = _lcount / (_slices -= SAMPLE_TRESHOLD_LOG); _sample = _slices * SAMPLE_SLICE_SIZE; - _cnt = (BUN *) alloca(_slices * sizeof(BUN)); + _cnt = GDKmalloc(_slices * sizeof(BUN)); + if (_cnt == NULL) + return NULL; for (_lo = 0; _idx < _slices; _lo += _step) { BUN _size = 0, _hi = _lo + SAMPLE_SLICE_SIZE; l = BATslice(_tmp1, _lo, _hi); /* slice keeps all parent properties */ - if (l == NULL) + if (l == NULL) { + GDKfree(_cnt); return NULL; + } _tmp2 = @2; /* @2 = e.g. BATXjoin(l,r) */ if (_tmp2) { _size = BATcount(_tmp2); @@ -105,7 +110,8 @@ _tot += (_cnt[_idx++] = _size); BBPreclaim(l); } - /* do outlier detection on sampling results; this guards against skew */ + /* do outlier detection on sampling results; + * this guards against skew */ if (@1 == JOIN_EQ) { for (_avg = _tot / _slices, _idx = 0; _idx < _slices; _idx++) { BUN _diff = _cnt[_idx] - _avg; @@ -116,7 +122,9 @@ break; } if (_idx < _slices) { - /* outliers detected, compute a real sample on at most 1% of the data */ + /* outliers detected, compute + * a real sample on at most 1% + * of the data */ _sample = MIN(_lcount / 100, (1 << SAMPLE_TRESHOLD_LOG) / 3); _tmp2 = BATsample(_tmp1, _sample); if (_tmp2) { @@ -127,10 +135,13 @@ } BBPreclaim(_tmp2); } - if (_tmp3 == NULL) + if (_tmp3 == NULL) { + GDKfree(_cnt); return NULL; + } } } + GDKfree(_cnt); /* overestimate always by 5% */ { double _d = (double) (((lng) _tot) * ((lng) _lcount)) / (0.95 * (double) _sample); @@ -2997,8 +3008,8 @@ int BATmultijoin(int argc, BAT *argv[], RowFcn tuple_fcn, ptr tuple_data, ColFcn value_fcn[], ptr value_data[], int orderby) { - column_t *lead_col, *c = (column_t *) alloca(argc * (int) sizeof(column_t)); - column_t **reorder = (column_t **) alloca(argc * (int) sizeof(column_t *)); + column_t *lead_col, *c = (column_t *) GDKmalloc(argc * (int) sizeof(column_t)); + column_t **reorder = (column_t **) GDKmalloc(argc * (int) sizeof(column_t *)); int status = 0, algo = LEAD_TRAVERSE_SEQ; int i, k; BUN p, q; @@ -3007,6 +3018,11 @@ @- Init the table descriptor. @c + if (c == NULL || reorder == NULL) { + GDKfree(c); + GDKfree(reorder); + return 0; + } memset(c, 0, argc * sizeof(column_t)); t.tuple_data = tuple_data; t.value_data = value_data; @@ -3137,11 +3153,15 @@ } else if (!BAThkey(n->b) && n->sync == NULL) { if (BATprepareHash(n->b)) { GDKerror("BATmultijoin: could not hash '%s'\n", BATgetId(n->b)); + GDKfree(c); + GDKfree(reorder); return 0; } n->hitsize = 20; n->hit = (BUN *) GDKmalloc(n->hitsize * sizeof(BUN)); _______________________________________________ Checkin-list mailing list Checkin-list@monetdb.org http://mail.monetdb.org/mailman/listinfo/checkin-list