Changeset: b7a38cc19cda for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/b7a38cc19cda
Branch: default
Log Message:

merged with jun2023


diffs (172 lines):

diff --git a/monetdb5/mal/mal_session.c b/monetdb5/mal/mal_session.c
--- a/monetdb5/mal/mal_session.c
+++ b/monetdb5/mal/mal_session.c
@@ -181,16 +181,9 @@ static str MSserveClient(Client cntxt);
 
 
 static inline void
-cleanUpScheduleClient(Client c, Scenario s, str *command, str *err)
+cleanUpScheduleClient(Client c, str *command, str *err)
 {
        if(c) {
-               if (s) {
-                       str msg = NULL;
-                       if((msg = s->exitClientCmd(c)) != MAL_SUCCEED) {
-                               mnstr_printf(c->fdout, "!%s\n", msg);
-                               freeException(msg);
-                       }
-               }
                MCcloseClient(c);
        }
        if (command) {
@@ -359,18 +352,15 @@ MSscheduleClient(str command, str challe
                        c->curmodule = c->usermodule = userModule();
                        if(c->curmodule  == NULL) {
                                mnstr_printf(fout, "!could not allocate 
space\n");
-                               cleanUpScheduleClient(c, NULL, &command, &msg);
+                               cleanUpScheduleClient(c, &command, &msg);
                                return;
                        }
                }
 
-               if ((s = setScenario(c, lang)) != NULL) {
-                       mnstr_printf(c->fdout, "!%s\n", s);
+               if ((msg = setScenario(c, lang)) != NULL) {
+                       mnstr_printf(c->fdout, "!%s\n", msg);
                        mnstr_flush(c->fdout, MNSTR_FLUSH_DATA);
-                       GDKfree(s);
-                       exit_streams(fin, fout);
-                       GDKfree(command);
-                       MCcloseClient(c);
+                       cleanUpScheduleClient(c, &command, &msg);
                        return;
                }
                if (!GDKgetenv_isyes(mal_enableflag) &&
@@ -378,14 +368,14 @@ MSscheduleClient(str command, str challe
 
                        mnstr_printf(fout, "!only the 'monetdb' user can use 
non-sql languages. "
                                                   "run mserver5 with --set 
%s=yes to change this.\n", mal_enableflag);
-                       cleanUpScheduleClient(c, NULL, &command, &msg);
+                       cleanUpScheduleClient(c, &command, &msg);
                        return;
                }
        }
 
        if((msg = MSinitClientPrg(c, "user", "main")) != MAL_SUCCEED) {
                mnstr_printf(fout, "!could not allocate space\n");
-               cleanUpScheduleClient(c, NULL, &command, &msg);
+               cleanUpScheduleClient(c, &command, &msg);
                return;
        }
 
@@ -423,7 +413,7 @@ MSscheduleClient(str command, str challe
                                GDKfree(algo);
                        if (c->exitClient)
                                c->exitClient(c);
-                       cleanUpScheduleClient(c, NULL, NULL, &msg);
+                       cleanUpScheduleClient(c, NULL, &msg);
                        return;
                }
        }
diff --git a/monetdb5/modules/mal/pcre.c b/monetdb5/modules/mal/pcre.c
--- a/monetdb5/modules/mal/pcre.c
+++ b/monetdb5/modules/mal/pcre.c
@@ -1027,7 +1027,7 @@ sql2pcre(str *r, const char *pat, const 
        int escaped = 0;
        int hasWildcard = 0;
        char *ppat;
-       int esc = esc_str[0] == '\200' ? 0 : esc_str[0]; /* should change to 
utf8_convert() */
+       int esc = strNil(esc_str) ? 0 : esc_str[0]; /* should change to 
utf8_convert() */
        int specials;
        int c;
 
@@ -1389,11 +1389,11 @@ re_like_build(struct RE **re, uint32_t *
 }
 
 #define proj_scanloop(TEST)    \
-       do {    \
-               if (*s == '\200') \
+       do {                                    \
+               if (strNil(s))          \
                        return bit_nil; \
-               else \
-                       return TEST; \
+               else                            \
+                       return TEST;    \
        } while (0)
 
 static inline bit
@@ -1490,7 +1490,7 @@ pcre_like_build(regex_t *res, void *ex, 
 #define PCRE_LIKE_BODY(LOOP_BODY, RES1, RES2) \
        do { \
                LOOP_BODY  \
-               if (*s == '\200') \
+               if (strNil(s))          \
                        *ret = bit_nil; \
                else if (pos >= 0) \
                        *ret = RES1; \
@@ -1736,7 +1736,7 @@ BATPCREnotlike(Client cntxt, MalBlkPtr m
                                GDK_CHECK_TIMEOUT(timeoffset, counter,          
                        \
                                                                  
GOTO_LABEL_TIMEOUT_HANDLER(bailout)); \
                                const char *restrict v = BUNtvar(bi, p - off);  
                \
-                               if ((TEST) || ((KEEP_NULLS) && *v == '\200'))   
                \
+                               if ((TEST) || ((KEEP_NULLS) && strNil(v)))      
                        \
                                        vals[cnt++] = p;                        
                                                \
                        }                                                       
                                                                \
                } else {                                                        
                                                        \
@@ -1745,7 +1745,7 @@ BATPCREnotlike(Client cntxt, MalBlkPtr m
                                                                  
GOTO_LABEL_TIMEOUT_HANDLER(bailout)); \
                                oid o = canditer_next(ci);                      
                                        \
                                const char *restrict v = BUNtvar(bi, o - off);  
                \
-                               if ((TEST) || ((KEEP_NULLS) && *v == '\200'))   
                \
+                               if ((TEST) || ((KEEP_NULLS) && strNil(v)))      
                        \
                                        vals[cnt++] = o;                        
                                                \
                        }                                                       
                                                                \
                }                                                               
                                                                \
@@ -1783,9 +1783,9 @@ pcre_likeselect(BAT *bn, BAT *b, BAT *s,
                goto bailout;
 
        if (anti)
-               pcrescanloop(v && *v != '\200' && !PCRE_LIKESELECT_BODY, 
keep_nulls);
+               pcrescanloop(!strNil(v) && !PCRE_LIKESELECT_BODY, keep_nulls);
        else
-               pcrescanloop(v && *v != '\200' && PCRE_LIKESELECT_BODY, 
keep_nulls);
+               pcrescanloop(!strNil(v) && PCRE_LIKESELECT_BODY, keep_nulls);
 
 bailout:
        bat_iterator_end(&bi);
@@ -1816,26 +1816,26 @@ re_likeselect(BAT *bn, BAT *b, BAT *s, s
        if (use_strcmp) {
                if (caseignore) {
                        if (anti)
-                               pcrescanloop(v && *v != '\200' && 
mywstrcasecmp(v, wpat) != 0, keep_nulls);
+                               pcrescanloop(!strNil(v) && mywstrcasecmp(v, 
wpat) != 0, keep_nulls);
                        else
-                               pcrescanloop(v && *v != '\200' && 
mywstrcasecmp(v, wpat) == 0, keep_nulls);
+                               pcrescanloop(!strNil(v) && mywstrcasecmp(v, 
wpat) == 0, keep_nulls);
                } else {
                        if (anti)
-                               pcrescanloop(v && *v != '\200' && strcmp(v, 
pat) != 0, keep_nulls);
+                               pcrescanloop(!strNil(v) && strcmp(v, pat) != 0, 
keep_nulls);
                        else
-                               pcrescanloop(v && *v != '\200' && strcmp(v, 
pat) == 0, keep_nulls);
+                               pcrescanloop(!strNil(v) && strcmp(v, pat) == 0, 
keep_nulls);
                }
        } else {
                if (caseignore) {
                        if (anti)
-                               pcrescanloop(v && *v != '\200' && 
!re_match_ignore(v, re), keep_nulls);
+                               pcrescanloop(!strNil(v) && !re_match_ignore(v, 
re), keep_nulls);
                        else
-                               pcrescanloop(v && *v != '\200' && 
re_match_ignore(v, re), keep_nulls);
+                               pcrescanloop(!strNil(v) && re_match_ignore(v, 
re), keep_nulls);
                } else {
                        if (anti)
-                               pcrescanloop(v && *v != '\200' && 
!re_match_no_ignore(v, re), keep_nulls);
+                               pcrescanloop(!strNil(v) && 
!re_match_no_ignore(v, re), keep_nulls);
                        else
-                               pcrescanloop(v && *v != '\200' && 
re_match_no_ignore(v, re), keep_nulls);
+                               pcrescanloop(!strNil(v) && 
re_match_no_ignore(v, re), keep_nulls);
                }
        }
 
_______________________________________________
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org

Reply via email to