Changeset: b585bedc68a6 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=b585bedc68a6
Modified Files:
        gdk/gdk_calc.c
        gdk/gdk_calc_compare.h
        monetdb5/modules/atoms/json.c
        monetdb5/modules/kernel/batstr.c
        monetdb5/modules/mal/mal_mapi.c
        monetdb5/modules/mal/remote.c
        sql/backends/monet5/UDF/capi/capi.c
        sql/backends/monet5/UDF/udf/udf.c
        sql/backends/monet5/sql.c
        sql/backends/monet5/sql_cat.c
        sql/backends/monet5/sql_transaction.c
        sql/server/rel_schema.c
        sql/server/sql_privileges.c
        sql/storage/store.c
Branch: linear-hashing
Log Message:

Merge with Nov2019 branch.


diffs (truncated from 415 to 300 lines):

diff --git a/gdk/gdk_calc.c b/gdk/gdk_calc.c
--- a/gdk/gdk_calc.c
+++ b/gdk/gdk_calc.c
@@ -14365,7 +14365,7 @@ VARconvert(ValPtr ret, const ValRecord *
                if (VALinit(ret, ret->vtype, ATOMnilptr(ret->vtype)) == NULL)
                        nils = BUN_NONE;
        } else if (v->vtype == TYPE_str) {
-               if (v->val.sval == NULL || strNil(v->val.sval)) {
+               if (strNil(v->val.sval)) {
                        if (VALinit(ret, ret->vtype, ATOMnilptr(ret->vtype)) == 
NULL)
                                nils = BUN_NONE;
                } else if (ATOMstorage(ret->vtype) == TYPE_ptr) {
diff --git a/gdk/gdk_calc_compare.h b/gdk/gdk_calc_compare.h
--- a/gdk/gdk_calc_compare.h
+++ b/gdk/gdk_calc_compare.h
@@ -708,12 +708,10 @@ op_typeswitchloop(const void *lft, int t
                        const char *s1, *s2;
                        s1 = hp1 ? hp1 + VarHeapVal(lft, i, wd1) : (const char 
*) lft;
                        s2 = hp2 ? hp2 + VarHeapVal(rgt, j, wd2) : (const char 
*) rgt;
-                       if (s1 == NULL || strNil(s1) ||
-                           s2 == NULL || strNil(s2)) {
+                       if (strNil(s1) || strNil(s2)) {
 #ifdef NIL_MATCHES_FLAG
                                if (nil_matches) {
-                                       dst[k] = OP(s1 == NULL || strNil(s1),
-                                                   s2 == NULL || strNil(s2));
+                                       dst[k] = OP(strNil(s1), strNil(s2));
                                } else
 #endif
                                {
diff --git a/monetdb5/modules/kernel/batstr.c b/monetdb5/modules/kernel/batstr.c
--- a/monetdb5/modules/kernel/batstr.c
+++ b/monetdb5/modules/kernel/batstr.c
@@ -131,7 +131,7 @@ do_batstr_int(bat *ret, const bat *l, co
 
        BATloop(b, p, q) {
                x = (str) BUNtvar(bi, p);
-               if (x == 0 || strNil(x)) {
+               if (strNil(x)) {
                        y = int_nil;
                        bn->tnonil = false;
                        bn->tnil = true;
@@ -180,7 +180,7 @@ do_batstr_str(bat *ret, const bat *l, co
        BATloop(b, p, q) {
                y = NULL;
                x = (str) BUNtvar(bi, p);
-               if (x != 0 && !strNil(x) &&
+               if (!strNil(x) &&
                        (msg = (*func)(&y, &x)) != MAL_SUCCEED)
                        goto bailout;
                if (y == NULL)
@@ -227,7 +227,7 @@ do_batstr_conststr_str(bat *ret, const b
        BATloop(b, p, q) {
                y = NULL;
                x = (str) BUNtvar(bi, p);
-               if (x != 0 && !strNil(x) &&
+               if (!strNil(x) &&
                        (msg = (*func)(&y, &x, s2)) != MAL_SUCCEED)
                        goto bailout;
                if (y == NULL)
@@ -281,8 +281,8 @@ do_batstr_batstr_str(bat *ret, const bat
                y = NULL;
                x = (str) BUNtvar(bi, p);
                x2 = (str) BUNtvar(bi2, p);
-               if (x != 0 && !strNil(x) &&
-                       x2 != 0 && !strNil(x2) &&
+               if (!strNil(x) &&
+                       !strNil(x2) &&
                        (msg = (*func)(&y, &x, &x2)) != MAL_SUCCEED)
                        goto bailout;
                if (y == NULL)
@@ -330,7 +330,7 @@ do_batstr_constint_str(bat *ret, const b
        BATloop(b, p, q) {
                y = NULL;
                x = (str) BUNtvar(bi, p);
-               if (x != 0 && !strNil(x) &&
+               if (!strNil(x) &&
                        (msg = (*func)(&y, &x, n)) != MAL_SUCCEED)
                        goto bailout;
                if (y == NULL)
@@ -385,7 +385,7 @@ do_batstr_batint_str(bat *ret, const bat
                y = NULL;
                x = (str) BUNtvar(bi, p);
                nn = *(int *)BUNtloc(bi2, p);
-               if (x != 0 && !strNil(x) &&
+               if (!strNil(x) &&
                        (msg = (*func)(&y, &x, &nn)) != MAL_SUCCEED)
                        goto bailout;
                if (y == NULL)
@@ -433,7 +433,7 @@ do_batstr_constint_conststr_str(bat *ret
        BATloop(b, p, q) {
                y = NULL;
                x = (str) BUNtvar(bi, p);
-               if (x != 0 && !strNil(x) &&
+               if (!strNil(x) &&
                        (msg = (*func)(&y, &x, n, s2)) != MAL_SUCCEED)
                        goto bailout;
                if (y == NULL)
@@ -488,7 +488,7 @@ do_batstr_batint_conststr_str(bat *ret, 
                y = NULL;
                x = (str) BUNtvar(bi, p);
                nn = *(int *)BUNtloc(bi2, p);
-               if (x != 0 && !strNil(x) &&
+               if (!strNil(x) &&
                        (msg = (*func)(&y, &x, &nn, s2)) != MAL_SUCCEED)
                        goto bailout;
                if (y == NULL)
@@ -543,8 +543,8 @@ do_batstr_constint_batstr_str(bat *ret, 
                y = NULL;
                x = (str) BUNtvar(bi, p);
                x2 = (str) BUNtvar(bi2, p);
-               if (x != 0 && !strNil(x) &&
-                       x2 != 0 && !strNil(x2) &&
+               if (!strNil(x) &&
+                       !strNil(x2) &&
                        (msg = (*func)(&y, &x, n, &x2)) != MAL_SUCCEED)
                        goto bailout;
                if (y == NULL)
@@ -612,8 +612,8 @@ do_batstr_batint_batstr_str(bat *ret, co
                x = (str) BUNtvar(bi, p);
                nn = *(int *)BUNtloc(bi2, p);
                x2 = (str) BUNtvar(bi3, p);
-               if (x != 0 && !strNil(x) &&
-                       x2 != 0 && !strNil(x2) &&
+               if (!strNil(x) &&
+                       !strNil(x2) &&
                        (msg = (*func)(&y, &x, &nn, &x2)) != MAL_SUCCEED)
                        goto bailout;
                if (y == NULL)
@@ -1189,7 +1189,7 @@ STRbatSubstitutecst(bat *ret, const bat 
        BATloop(b, p, q) {
                y = (str) str_nil;
                x = (str) BUNtvar(bi, p);
-               if (x != 0 && !strNil(x) &&
+               if (!strNil(x) &&
                        (err = STRSubstitute(&y, &x, arg2, arg3, rep)) != 
MAL_SUCCEED)
                        goto bunins_failed;
                if (bunfastappVAR(bn, y) != GDK_SUCCEED)
diff --git a/monetdb5/modules/mal/mal_mapi.c b/monetdb5/modules/mal/mal_mapi.c
--- a/monetdb5/modules/mal/mal_mapi.c
+++ b/monetdb5/modules/mal/mal_mapi.c
@@ -573,7 +573,7 @@ SERVERlisten(int port, const char *usock
        if (psock == NULL)
                throw(MAL,"mal_mapi.listen", SQLSTATE(HY013) MAL_MALLOC_FAIL);
 
-       if (usockfile == NULL || strNil(usockfile)) {
+       if (strNil(usockfile)) {
                usockfile = NULL;
        } else {
 #ifndef HAVE_SYS_UN_H
diff --git a/monetdb5/modules/mal/remote.c b/monetdb5/modules/mal/remote.c
--- a/monetdb5/modules/mal/remote.c
+++ b/monetdb5/modules/mal/remote.c
@@ -916,7 +916,7 @@ static str RMTregisterInternal(Client cn
        MapiHdl mhdl = NULL;
        Symbol sym;
 
-       if (conn == NULL || strNil(conn))
+       if (strNil(conn))
                throw(ILLARG, "remote.register", ILLEGAL_ARGUMENT ": connection 
name is NULL or nil");
 
        /* find local definition */
diff --git a/sql/backends/monet5/UDF/capi/capi.c 
b/sql/backends/monet5/UDF/capi/capi.c
--- a/sql/backends/monet5/UDF/capi/capi.c
+++ b/sql/backends/monet5/UDF/capi/capi.c
@@ -1451,7 +1451,7 @@ static str CUDFeval(Client cntxt, MalBlk
                                for (j = 0; j < count; j++) {
                                        const char *ptr = source_base[j];
                                        const void *appended_element;
-                                       if (!ptr || strNil(ptr)) {
+                                       if (strNil(ptr)) {
                                                appended_element = (void 
*)BATatoms[bat_type].atomNull;
                                        } else {
                                                if 
(BATatoms[bat_type].atomFromStr(ptr, &len, &element, false) ==
diff --git a/sql/backends/monet5/UDF/udf/udf.c 
b/sql/backends/monet5/UDF/udf/udf.c
--- a/sql/backends/monet5/UDF/udf/udf.c
+++ b/sql/backends/monet5/UDF/udf/udf.c
@@ -24,7 +24,7 @@ UDFreverse_(char **ret, const char *src)
        assert(ret != NULL);
 
        /* handle NULL pointer and NULL value */
-       if (src == NULL || strNil(src)) {
+       if (strNil(src)) {
                *ret = GDKstrdup(str_nil);
                if (*ret == NULL)
                        throw(MAL, "udf.reverse",
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
@@ -1263,7 +1263,7 @@ mvc_bind_wrap(Client cntxt, MalBlkPtr mb
                }
                return MAL_SUCCEED;
        }
-       if (sname && !strNil(sname))
+       if (!strNil(sname))
                throw(SQL, "sql.bind", SQLSTATE(42000) "unable to find 
%s.%s(%s)", sname, tname, cname);
        throw(SQL, "sql.bind", SQLSTATE(42000) "unable to find %s(%s)", tname, 
cname);
 }
@@ -3058,7 +3058,7 @@ mvc_import_table_wrap(Client cntxt, MalB
        if (*ssep == 0 || strNil(ssep))
                ssep = NULL;
 
-       if (fname != NULL && strNil(fname))
+       if (strNil(fname))
                fname = NULL;
        if (fname == NULL) {
                msg = mvc_import_table(cntxt, &b, be->mvc, be->mvc->scanner.rs, 
t, tsep, rsep, ssep, ns, sz, offset, locked, besteffort, true);
@@ -3101,7 +3101,7 @@ mvc_import_table_wrap(Client cntxt, MalB
                        }
                }
 
-               if (fixed_widths && !strNil(fixed_widths)) {
+               if (!strNil(fixed_widths)) {
                        size_t ncol = 0, current_width_entry = 0, i;
                        size_t *widths;
                        char* val_start = fixed_widths;
@@ -3554,7 +3554,7 @@ str_2time_daytimetz(daytime *res, const 
        size_t len = sizeof(daytime);
        ssize_t pos;
 
-       if (!*v || strNil(*v)) {
+       if (strNil(*v)) {
                *res = daytime_nil;
                return MAL_SUCCEED;
        }
@@ -3641,7 +3641,7 @@ str_2time_timestamptz(timestamp *res, co
        size_t len = sizeof(timestamp);
        ssize_t pos;
 
-       if (!*v || strNil(*v)) {
+       if (strNil(*v)) {
                *res = timestamp_nil;
                return MAL_SUCCEED;
        }
@@ -4766,7 +4766,7 @@ sql_storage(Client cntxt, MalBlkPtr mb, 
                                                                                
cnt1 = cnt2 = 512;
                                                                        
BATloop(bn, p, q) {
                                                                                
str s = BUNtvar(bi, p);
-                                                                               
if (s != NULL && !strNil(s))
+                                                                               
if (!strNil(s))
                                                                                
        sum += strlen(s);
                                                                                
if (--cnt1 <= 0)
                                                                                
        break;
@@ -4884,7 +4884,7 @@ sql_storage(Client cntxt, MalBlkPtr mb, 
                                                                                
        cnt1 = cnt2 = 512;
                                                                                
BATloop(bn, p, q) {
                                                                                
        str s = BUNtvar(bi, p);
-                                                                               
        if (s != NULL && !strNil(s))
+                                                                               
        if (!strNil(s))
                                                                                
                sum += strlen(s);
                                                                                
        if (--cnt1 <= 0)
                                                                                
                break;
diff --git a/sql/backends/monet5/sql_cat.c b/sql/backends/monet5/sql_cat.c
--- a/sql/backends/monet5/sql_cat.c
+++ b/sql/backends/monet5/sql_cat.c
@@ -50,7 +50,7 @@ SaveArgReference(MalStkPtr stk, InstrPtr
 {
        char *val = *getArgReference_str(stk, pci, arg);
 
-       if (val && strNil(val))
+       if (strNil(val))
                val = NULL;
        return val;
 }
@@ -1256,7 +1256,7 @@ SQLgrant(Client cntxt, MalBlkPtr mb, Mal
        sqlid grantor = (sqlid) *getArgReference_int(stk, pci, 7);
 
        initcontext();
-       if (!tname || strNil(tname))
+       if (strNil(tname))
                msg = sql_grant_global_privs(sql, grantee, privs, grant, 
grantor);
        else
                msg = sql_grant_table_privs(sql, grantee, privs, sname, tname, 
cname, grant, grantor);
@@ -1275,7 +1275,7 @@ str SQLrevoke(Client cntxt, MalBlkPtr mb
        sqlid grantor = (sqlid) *getArgReference_int(stk, pci, 7);
 
        initcontext();
-       if (!tname || strNil(tname))
+       if (strNil(tname))
                msg = sql_revoke_global_privs(sql, grantee, privs, grant, 
grantor);
        else
                msg = sql_revoke_table_privs(sql, grantee, privs, sname, tname, 
cname, grant, grantor);
@@ -1449,9 +1449,9 @@ SQLcreate_trigger(Client cntxt, MalBlkPt
        char *query = *getArgReference_str(stk, pci, 10);
 
        initcontext();
-       old_name=(!old_name || strNil(old_name))?NULL:old_name; 
-       new_name=(!new_name || strNil(new_name))?NULL:new_name; 
-       condition=(!condition || strNil(condition))?NULL:condition;
+       old_name=(strNil(old_name))?NULL:old_name; 
+       new_name=(strNil(new_name))?NULL:new_name; 
+       condition=(strNil(condition))?NULL:condition;
        msg = create_trigger(sql, sname, tname, triggername, time, orientation, 
event, old_name, new_name, condition, query);
        return msg;
 }
@@ -1575,7 +1575,7 @@ SQLcomment_on(Client cntxt, MalBlkPtr mb
        if (!id_col || !remark_col)
                throw(SQL, "sql.comment_on", SQLSTATE(3F000) "no table 
sys.comments");
        rid = table_funcs.column_find_row(tx, id_col, &objid, NULL);
-       if (remark != NULL && *remark && !strNil(remark)) {
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to