Changeset: 947f7ca4dde3 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=947f7ca4dde3 Modified Files: gdk/gdk_calc.c gdk/gdk_calc_compare.h gdk/gdk_string.c geom/monetdb5/geom.c monetdb5/extras/rapi/converters.c.h monetdb5/modules/atoms/identifier.c monetdb5/modules/atoms/json.c monetdb5/modules/atoms/mtime.c monetdb5/modules/kernel/batstr.c monetdb5/modules/mal/clients.c monetdb5/modules/mal/mal_mapi.c monetdb5/modules/mal/pcre.c monetdb5/modules/mal/remote.c sql/backends/monet5/UDF/capi/capi.c sql/backends/monet5/UDF/pyapi3/conversion3.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_mvc.c sql/server/sql_partition.c sql/server/sql_privileges.c sql/storage/store.c sql/test/miscellaneous/Tests/simple_selects.sql sql/test/miscellaneous/Tests/simple_selects.stable.out Branch: default Log Message:
Merged with linear-hashing diffs (truncated from 1011 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 @@ -3456,7 +3456,7 @@ addstr_loop(BAT *b1, const char *l, BAT l = BUNtvar(b1i, i); if (b2) r = BUNtvar(b2i, i); - if (strcmp(l, str_nil) == 0 || strcmp(r, str_nil) == 0) { + if (strNil(l) || strNil(r)) { nils++; if (tfastins_nocheckVAR(bn, i, str_nil, Tsize(bn)) != GDK_SUCCEED) goto bunins_failed; @@ -13640,7 +13640,7 @@ convert_str_any(BAT *b, int tp, void *re nils++; } s = BUNtvar(bi, i); - if (strcmp(s, str_nil) == 0) { + if (strNil(s)) { memcpy(dst, nil, len); nils++; } else { @@ -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 || strcmp(v->val.sval, str_nil) == 0) { + if (v->val.sval == NULL || 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,12 @@ 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 || strcmp(s1, str_nil) == 0 || - s2 == NULL || strcmp(s2, str_nil) == 0) { + if (s1 == NULL || strNil(s1) || + s2 == NULL || strNil(s2)) { #ifdef NIL_MATCHES_FLAG if (nil_matches) { - dst[k] = OP(s1 == NULL || strcmp(s1, str_nil) == 0, - s2 == NULL || strcmp(s2, str_nil) == 0); + dst[k] = OP(s1 == NULL || strNil(s1), + s2 == NULL || strNil(s2)); } else #endif { diff --git a/gdk/gdk_string.c b/gdk/gdk_string.c --- a/gdk/gdk_string.c +++ b/gdk/gdk_string.c @@ -366,7 +366,7 @@ GDKstrFromStr(unsigned char *restrict ds bool escaped = false; int mask = 0, n, c, utf8char = 0; - if (len >= 2 && strcmp((const char *) src, str_nil) == 0) { + if (len >= 2 && strNil((const char *) src)) { strcpy((char *) dst, str_nil); return 1; } diff --git a/geom/monetdb5/geom.c b/geom/monetdb5/geom.c --- a/geom/monetdb5/geom.c +++ b/geom/monetdb5/geom.c @@ -415,8 +415,8 @@ wkbTransform(wkb **transformedWKB, wkb * if (is_wkb_nil(*geomWKB) || is_int_nil(*srid_src) || is_int_nil(*srid_dst) || - strcmp(*proj4_src_str, str_nil) == 0 || - strcmp(*proj4_dst_str, str_nil) == 0) { + strNil(*proj4_src_str) || + strNil(*proj4_dst_str)) { if ((*transformedWKB = wkbNULLcopy()) == NULL) throw(MAL, "geom.Transform", SQLSTATE(HY013) MAL_MALLOC_FAIL); return MAL_SUCCEED; @@ -2430,7 +2430,7 @@ wkbFromBinary(wkb **geomWKB, const char size_t strLength, wkbLength, i; wkb *w; - if (strcmp(*inStr, str_nil) == 0) { + if (strNil(*inStr)) { if ((*geomWKB = wkbNULLcopy()) == NULL) throw(MAL, "geom.FromBinary", SQLSTATE(HY013) MAL_MALLOC_FAIL); return MAL_SUCCEED; @@ -2505,7 +2505,7 @@ wkbFromText(wkb **geomWKB, str *geomWKT, size_t parsedBytes; *geomWKB = NULL; - if (strcmp(*geomWKT, str_nil) == 0 || is_int_nil(*srid) || is_int_nil(*tpe)) { + if (strNil(*geomWKT) || is_int_nil(*srid) || is_int_nil(*tpe)) { if ((*geomWKB = wkbNULLcopy()) == NULL) throw(MAL, "wkb.FromText", SQLSTATE(HY013) MAL_MALLOC_FAIL); return MAL_SUCCEED; @@ -2579,7 +2579,7 @@ wkbMLineStringToPolygon(wkb **geomWKB, s double *linestringsArea; bit ordered = 0; - if (strcmp(*geomWKT, str_nil) == 0 || is_int_nil(*srid) || is_int_nil(*flag)) { + if (strNil(*geomWKT) || is_int_nil(*srid) || is_int_nil(*flag)) { if ((*geomWKB = wkbNULLcopy()) == NULL) throw(MAL, "geom.MLineStringToPolygon", SQLSTATE(HY013) MAL_MALLOC_FAIL); return MAL_SUCCEED; @@ -4377,7 +4377,7 @@ wkbRelate(bit *out, wkb **geomWKB_a, wkb int res; GEOSGeom geosGeometry_a, geosGeometry_b; - if (is_wkb_nil(*geomWKB_a) || is_wkb_nil(*geomWKB_b) || strcmp(*pattern, str_nil) == 0) { + if (is_wkb_nil(*geomWKB_a) || is_wkb_nil(*geomWKB_b) || strNil(*pattern)) { *out = bit_nil; return MAL_SUCCEED; } @@ -5303,7 +5303,7 @@ mbrFROMSTR(const char *src, size_t *len, **atom = *mbrNULL(); return 3; } - if (strcmp(src, str_nil) == 0) { + if (strNil(src)) { **atom = *mbrNULL(); return 1; } @@ -5470,7 +5470,7 @@ wkbaTOSTR(char **toStr, size_t *len, con } dataSize += ds; - if (strcmp(partialStrs[i], str_nil) == 0) { + if (strNil(partialStrs[i])) { GDKfree(itemsNumStr); while (i >= 0) GDKfree(partialStrs[i--]); diff --git a/monetdb5/extras/rapi/converters.c.h b/monetdb5/extras/rapi/converters.c.h --- a/monetdb5/extras/rapi/converters.c.h +++ b/monetdb5/extras/rapi/converters.c.h @@ -181,7 +181,7 @@ bat_to_sexp(BAT* b, int type) const char *t = (const char *) BUNtvar(li, p); ptrdiff_t offset = t - b->tvheap->base; if (!sexp_ptrs[offset]) { - if (strcmp(t, str_nil) == 0) { + if (strNil(t)) { sexp_ptrs[offset] = NA_STRING; } else { sexp_ptrs[offset] = RSTR(t); @@ -201,7 +201,7 @@ bat_to_sexp(BAT* b, int type) else { BATloop(b, p, q) { const char *t = (const char *) BUNtvar(li, p); - if (strcmp(t, str_nil) == 0) { + if (strNil(t)) { SET_STRING_ELT(varvalue, j++, NA_STRING); } else { SET_STRING_ELT(varvalue, j++, RSTR(t)); diff --git a/monetdb5/modules/atoms/identifier.c b/monetdb5/modules/atoms/identifier.c --- a/monetdb5/modules/atoms/identifier.c +++ b/monetdb5/modules/atoms/identifier.c @@ -72,7 +72,7 @@ ssize_t IDtoString(str *retval, size_t *len, const char *handle, bool external) { size_t hl = strlen(handle) + 1; - if (external && strcmp(handle, str_nil) == 0) + if (external && strNil(handle)) hl = 4; if (*len < hl || *retval == NULL) { GDKfree(*retval); @@ -81,7 +81,7 @@ IDtoString(str *retval, size_t *len, con return -1; *len = hl; } - if (external && strcmp(handle, str_nil) == 0) + if (external && strNil(handle)) strcpy(*retval, "nil"); else memcpy(*retval, handle, hl); diff --git a/monetdb5/modules/atoms/json.c b/monetdb5/modules/atoms/json.c --- a/monetdb5/modules/atoms/json.c +++ b/monetdb5/modules/atoms/json.c @@ -1891,7 +1891,7 @@ JSONfoldKeyValue(str *ret, const bat *id goto memfail; } row = p; - if (strcmp(nme, str_nil)) { + if (!strNil(nme)) { snprintf(row + len, lim - len, "\"%s\":", nme); len += l + 3; } diff --git a/monetdb5/modules/atoms/mtime.c b/monetdb5/modules/atoms/mtime.c --- a/monetdb5/modules/atoms/mtime.c +++ b/monetdb5/modules/atoms/mtime.c @@ -524,7 +524,7 @@ parse_date(const char *buf, date *d, boo int sep; *d = date_nil; - if (strcmp(buf, str_nil) == 0) + if (strNil(buf)) return 1; if (external && strncmp(buf, "nil", 3) == 0) return 3; @@ -658,7 +658,7 @@ parse_daytime(const char *buf, daytime * ssize_t pos = 0; *dt = daytime_nil; - if (strcmp(buf, str_nil) == 0) + if (strNil(buf)) return 1; if (external && strncmp(buf, "nil", 3) == 0) return 3; 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 || strcmp(x, str_nil) == 0) { + if (x == 0 || 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 && strcmp(x, str_nil) != 0 && + if (x != 0 && !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 && strcmp(x, str_nil) != 0 && + if (x != 0 && !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 && strcmp(x, str_nil) != 0 && - x2 != 0 && strcmp(x2, str_nil) != 0 && + if (x != 0 && !strNil(x) && + x2 != 0 && !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 && strcmp(x, str_nil) != 0 && + if (x != 0 && !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 && strcmp(x, str_nil) != 0 && + if (x != 0 && !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 && strcmp(x, str_nil) != 0 && + if (x != 0 && !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 && strcmp(x, str_nil) != 0 && + if (x != 0 && !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 && strcmp(x, str_nil) != 0 && - x2 != 0 && strcmp(x2, str_nil) != 0 && + if (x != 0 && !strNil(x) && + x2 != 0 && !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 && strcmp(x, str_nil) != 0 && - x2 != 0 && strcmp(x2, str_nil) != 0 && + if (x != 0 && !strNil(x) && _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list