Changeset: d5a480f9b110 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/d5a480f9b110
Modified Files:
        clients/Tests/exports.stable.out
        gdk/gdk_utils.c
        gdk/gdk_utils.h
        tools/monetdbe/monetdbe.c
Branch: pp_hashjoin
Log Message:

Merge with default branch.


diffs (258 lines):

diff --git a/clients/Tests/exports.stable.out b/clients/Tests/exports.stable.out
--- a/clients/Tests/exports.stable.out
+++ b/clients/Tests/exports.stable.out
@@ -287,8 +287,8 @@ bool GDKembedded(void);
 bool GDKexiting(void);
 _Noreturn void GDKfatal(_In_z_ _Printf_format_string_ const char *format, ...) 
__attribute__((__format__(__printf__, 1, 2)));
 jmp_buf GDKfataljump;
-bit GDKfataljumpenable;
-str GDKfatalmsg;
+bool GDKfataljumpenable;
+char *GDKfatalmsg;
 gdk_return GDKfilepath(char *buf, size_t bufsize, int farmid, const char *dir, 
const char *nme, const char *ext) __attribute__((__access__(write_only, 1, 2)));
 void GDKfree(void *blk);
 char *GDKgetbuf(void);
@@ -329,9 +329,9 @@ stream *GDKstdout;
 ssize_t GDKstrFromStr(unsigned char *restrict dst, const unsigned char 
*restrict src, ssize_t len, char quote);
 int GDKstrcasecmp(const char *s1, const char *s2);
 char *GDKstrcasestr(const char *haystack, const char *needle);
-str GDKstrdup(const char *s) __attribute__((__malloc__)) 
__attribute__((__malloc__(GDKfree, 1))) __attribute__((__warn_unused_result__));
+char *GDKstrdup(const char *s) __attribute__((__malloc__)) 
__attribute__((__malloc__(GDKfree, 1))) __attribute__((__warn_unused_result__));
 int GDKstrncasecmp(const char *str1, const char *str2, size_t l1, size_t l2);
-str GDKstrndup(const char *s, size_t n) __attribute__((__malloc__)) 
__attribute__((__malloc__(GDKfree, 1))) __attribute__((__warn_unused_result__));
+char *GDKstrndup(const char *s, size_t n) __attribute__((__malloc__)) 
__attribute__((__malloc__(GDKfree, 1))) __attribute__((__warn_unused_result__));
 gdk_return GDKtolower(allocator *ma, char **restrict buf, size_t *restrict 
buflen, const char *restrict s) __attribute__((__access__(read_write, 2))) 
__attribute__((__access__(read_write, 3)));
 gdk_return GDKtoupper(allocator *ma, char **restrict buf, size_t *restrict 
buflen, const char *restrict s) __attribute__((__access__(read_write, 2))) 
__attribute__((__access__(read_write, 3)));
 gdk_return GDKtracer_fill_comp_info(BAT *id, BAT *component, BAT *log_level);
diff --git a/gdk/gdk_time.c b/gdk/gdk_time.c
--- a/gdk/gdk_time.c
+++ b/gdk/gdk_time.c
@@ -598,43 +598,36 @@ static ssize_t
 fleximatch(const char *s, const char *pat, size_t min)
 {
        size_t hit;
-       bool spacy = false;
 
        if (min == 0) {
-               min = (int) strlen(pat);        /* default minimum required 
hits */
+               min = strlen(pat);      /* default minimum required hits */
        }
        for (hit = 0; *pat; hit++) {
                if (tolower((unsigned char) s[hit]) != (unsigned char) *pat) {
-                       if (GDKisspace(s[hit]) && spacy) {
-                               min++;
-                               continue;               /* extra spaces */
-                       }
                        break;
                }
-               spacy = GDKisspace(*pat);
                pat++;
        }
        return (hit >= min) ? hit : 0;
 }
 
 static ssize_t
-parse_substr(int *ret, const char *s, size_t min, const char *list[], int size)
+parse_substr(int *ret, const char *s, size_t min, const char *const list[], 
int size)
 {
-       ssize_t j = 0;
-       int i = 0;
+       for (int i = 0; i < size; i++) {
+               ssize_t j = 0;
 
-       *ret = int_nil;
-       while (++i <= size) {
                if ((j = fleximatch(s, list[i], min)) > 0) {
-                       *ret = i;
-                       break;
+                       *ret = i + 1;
+                       return j;
                }
        }
-       return j;
+       *ret = int_nil;
+       return 0;
 }
 
-static const char *MONTHS[13] = {
-       NULL, "january", "february", "march", "april", "may", "june",
+static const char *const months[12] = {
+       "january", "february", "march", "april", "may", "june",
        "july", "august", "september", "october", "november", "december"
 };
 
@@ -681,7 +674,7 @@ parse_date(const char *buf, date *d, boo
                        month = (buf[pos++] - '0') + month * 10;
                }
        } else {
-               pos += parse_substr(&month, buf + pos, 3, MONTHS, 12);
+               pos += parse_substr(&month, buf + pos, 3, months, 12);
        }
        if (is_int_nil(month) || (sep && buf[pos++] != sep)) {
                GDKerror("Syntax error in date.\n");
@@ -912,7 +905,7 @@ daytime_tz_fromstr_internal(allocator *m
        while (GDKisspace(*s))
                s++;
        /* for GMT we need to add the time zone */
-       if (fleximatch(s, "gmt", 0) == 3) {
+       if (strcasecmp(s, "gmt") == 0) {
                s += 3;
        }
        if ((s[0] == '-' || s[0] == '+') &&
@@ -1071,7 +1064,7 @@ timestamp_fromstr_internal(allocator *ma
                        while (GDKisspace(*s))
                                s++;
                        /* in case of gmt we need to add the time zone */
-                       if (fleximatch(s, "gmt", 0) == 3) {
+                       if (strcasecmp(s, "gmt") == 0) {
                                s += 3;
                        }
                        if ((s[0] == '-' || s[0] == '+') &&
@@ -1113,7 +1106,7 @@ timestamp_tz_fromstr_internal(allocator 
        while (GDKisspace(*s))
                s++;
        /* in case of gmt we need to add the time zone */
-       if (fleximatch(s, "gmt", 0) == 3) {
+       if (strcasecmp(s, "gmt") == 0) {
                s += 3;
        }
        if ((s[0] == '-' || s[0] == '+') &&
diff --git a/gdk/gdk_utils.c b/gdk/gdk_utils.c
--- a/gdk/gdk_utils.c
+++ b/gdk/gdk_utils.c
@@ -1508,8 +1508,8 @@ GDKclrerr(void)
 }
 
 jmp_buf GDKfataljump;
-str GDKfatalmsg;
-bit GDKfataljumpenable = 0;
+char *GDKfatalmsg;
+bool GDKfataljumpenable = false;
 
 /* coverity[+kill] */
 void
diff --git a/gdk/gdk_utils.h b/gdk/gdk_utils.h
--- a/gdk/gdk_utils.h
+++ b/gdk/gdk_utils.h
@@ -101,11 +101,11 @@ gdk_export void *GDKzalloc(size_t size)
 gdk_export void *GDKrealloc(void *pold, size_t size)
        __attribute__((__alloc_size__(2)))
        __attribute__((__warn_unused_result__));
-gdk_export str GDKstrdup(const char *s)
+gdk_export char *GDKstrdup(const char *s)
        __attribute__((__malloc__))
        __attribute__((__malloc__(GDKfree, 1)))
        __attribute__((__warn_unused_result__));
-gdk_export str GDKstrndup(const char *s, size_t n)
+gdk_export char *GDKstrndup(const char *s, size_t n)
        __attribute__((__malloc__))
        __attribute__((__malloc__(GDKfree, 1)))
        __attribute__((__warn_unused_result__));
@@ -134,8 +134,8 @@ gdk_export const char *GDKlibversion(voi
 
 // these are used in embedded mode to jump out of GDKfatal
 gdk_export jmp_buf GDKfataljump;
-gdk_export str GDKfatalmsg;
-gdk_export bit GDKfataljumpenable;
+gdk_export char *GDKfatalmsg;
+gdk_export bool GDKfataljumpenable;
 
 /* Timers
  * The following relative timers are available for inspection.
diff --git a/sql/test/testdb-upgrade-chain-hge/Tests/upgrade.py 
b/sql/test/testdb-upgrade-chain-hge/Tests/upgrade.py
--- a/sql/test/testdb-upgrade-chain-hge/Tests/upgrade.py
+++ b/sql/test/testdb-upgrade-chain-hge/Tests/upgrade.py
@@ -42,7 +42,7 @@ with process.server(args=['--clean-BBP']
                         stdout=process.PIPE,
                         stderr=process.PIPE,
                         server=srv) as clt:
-        cltout, clterr = clt.communicate('drop all function testsschema.capi00 
if exists;\ndrop all function testsschema.rapi01 if exists;\ndrop all function 
testsschema.rapi02 if exists;\n')
+        cltout, clterr = clt.communicate('drop function if exists 
testschema.pyapi01;\ndrop function if exists testschema.pyapi02;\ndrop function 
if exists testschema.rapi01;\ndrop function if exists testschema.rapi02;\ndrop 
function if exists testschema.capi00;\ndrop function if exists 
testschema.pyapi10_mult;\ndrop aggregate if exists testschema.aggrmedian;\n')
     srvout, srverr = srv.communicate()
 
 srvout = [line for line in srvout.splitlines(keepends=True) if not 
line.startswith('#')]
diff --git a/sql/test/testdb-upgrade-chain/Tests/upgrade.py 
b/sql/test/testdb-upgrade-chain/Tests/upgrade.py
--- a/sql/test/testdb-upgrade-chain/Tests/upgrade.py
+++ b/sql/test/testdb-upgrade-chain/Tests/upgrade.py
@@ -42,7 +42,7 @@ with process.server(args=['--clean-BBP',
                         stdout=process.PIPE,
                         stderr=process.PIPE,
                         server=srv) as clt:
-        cltout, clterr = clt.communicate('drop all function testsschema.capi00 
if exists;\ndrop all function testsschema.rapi01 if exists;\ndrop all function 
testsschema.rapi02 if exists;\n')
+        cltout, clterr = clt.communicate('drop function if exists 
testschema.pyapi01;\ndrop function if exists testschema.pyapi02;\ndrop function 
if exists testschema.rapi01;\ndrop function if exists testschema.rapi02;\ndrop 
function if exists testschema.capi00;\ndrop function if exists 
testschema.pyapi10_mult;\ndrop aggregate if exists testschema.aggrmedian;\n')
     srvout, srverr = srv.communicate()
 
 srvout = [line for line in srvout.splitlines(keepends=True) if not 
line.startswith('#')]
diff --git a/sql/test/testdb-upgrade-hge/Tests/upgrade.py 
b/sql/test/testdb-upgrade-hge/Tests/upgrade.py
--- a/sql/test/testdb-upgrade-hge/Tests/upgrade.py
+++ b/sql/test/testdb-upgrade-hge/Tests/upgrade.py
@@ -41,6 +41,7 @@ with process.server(mapiport='0',
                         stdout=process.PIPE,
                         stderr=process.PIPE,
                         server=srv) as clt:
+        # don't drop foreign language functions since we want to test dump
         cltout, clterr = clt.communicate('select count(*) from 
testschema.smallstring;\n')
     srvout, srverr = srv.communicate()
 
diff --git a/sql/test/testdb-upgrade/Tests/upgrade.py 
b/sql/test/testdb-upgrade/Tests/upgrade.py
--- a/sql/test/testdb-upgrade/Tests/upgrade.py
+++ b/sql/test/testdb-upgrade/Tests/upgrade.py
@@ -42,6 +42,7 @@ with process.server(args=['--set', 'allo
                         stdout=process.PIPE,
                         stderr=process.PIPE,
                         server=srv) as clt:
+        # don't drop foreign language functions since we want to test dump
         cltout, clterr = clt.communicate('select count(*) from 
testschema.smallstring;\n')
     srvout, srverr = srv.communicate()
 
diff --git a/tools/monetdbe/monetdbe.c b/tools/monetdbe/monetdbe.c
--- a/tools/monetdbe/monetdbe.c
+++ b/tools/monetdbe/monetdbe.c
@@ -613,7 +613,7 @@ monetdbe_startup(monetdbe_database_inter
        int workers, memory;
        gdk_return gdk_res;
 
-       GDKfataljumpenable = 1;
+       GDKfataljumpenable = true;
 
        if(setjmp(GDKfataljump) != 0) {
                assert(0);
@@ -628,7 +628,7 @@ monetdbe_startup(monetdbe_database_inter
 
        if (monetdbe_embedded_initialized) {
                set_error(mdbe, createException(MAL, 
"monetdbe.monetdbe_startup", "MonetDBe is already initialized"));
-               GDKfataljumpenable = 0;
+               GDKfataljumpenable = false;
                return;
        }
 
@@ -761,7 +761,7 @@ monetdbe_startup(monetdbe_database_inter
        if (dbdir && !monetdbe_embedded_url)
                set_error(mdbe, createException(MAL, 
"monetdbe.monetdbe_startup", MAL_MALLOC_FAIL));
 cleanup:
-       GDKfataljumpenable = 0;
+       GDKfataljumpenable = false;
        if (mdbe->msg)
                monetdbe_shutdown_internal();
 }
diff --git a/tools/mserver/shutdowntest.c b/tools/mserver/shutdowntest.c
--- a/tools/mserver/shutdowntest.c
+++ b/tools/mserver/shutdowntest.c
@@ -97,7 +97,7 @@ static str monetdb_initialize(void) {
                goto cleanup;
        }
 
-       GDKfataljumpenable = 1;
+       GDKfataljumpenable = true;
        if(setjmp(GDKfataljump) != 0) {
                retval = GDKfatalmsg;
                // we will get here if GDKfatal was called.
@@ -261,7 +261,7 @@ static str monetdb_initialize(void) {
                retval = GDKstrdup("mal_init() failed");
                goto cleanup;
        }
-       GDKfataljumpenable = 0;
+       GDKfataljumpenable = false;
 
        if (retval != MAL_SUCCEED) {
                printf("Failed to load SQL function: %s\n", retval);
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to