Changeset: 7717aefccc37 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/7717aefccc37
Modified Files:
        gdk/gdk.h
        gdk/gdk_atoms.c
        gdk/gdk_value.c
        geom/monetdb5/geom.c
        monetdb5/mal/mal_client.c
        monetdb5/mal/mal_dataflow.c
        monetdb5/mal/mal_exception.c
        monetdb5/mal/mal_function.c
        monetdb5/mal/mal_instruction.c
        monetdb5/mal/mal_type.c
        monetdb5/modules/atoms/inet.c
        monetdb5/modules/atoms/json.c
        monetdb5/modules/atoms/mtime.c
        monetdb5/modules/atoms/str.c
        monetdb5/modules/atoms/url.c
        monetdb5/modules/atoms/xml.c
        monetdb5/modules/kernel/alarm.c
        monetdb5/modules/kernel/bat5.c
        monetdb5/modules/mal/bbp.c
        monetdb5/modules/mal/calc.c
        monetdb5/modules/mal/clients.c
        monetdb5/modules/mal/inspect.c
        monetdb5/modules/mal/mal_mapi.c
        monetdb5/modules/mal/mdb.c
        monetdb5/modules/mal/pcre.c
        monetdb5/modules/mal/remote.c
        monetdb5/modules/mal/tablet.c
        monetdb5/modules/mal/txtsim.c
Branch: Dec2025
Log Message:

Use ma_strdup and ma_strndup instead of MA_STRDUP and MA_STRNDUP.
And get rid of the latter two.


diffs (truncated from 1766 to 300 lines):

diff --git a/gdk/gdk.h b/gdk/gdk.h
--- a/gdk/gdk.h
+++ b/gdk/gdk.h
@@ -1774,8 +1774,6 @@ gdk_export void ma_info(const allocator 
 #define MA_NEW_ARRAY( sa, type, size )                 (type*)ma_alloc( sa, 
((size)*sizeof(type)))
 #define MA_ZNEW_ARRAY( sa, type, size )                        
(type*)ma_zalloc( sa, ((size)*sizeof(type)))
 #define MA_RENEW_ARRAY( sa, type, ptr, sz, osz )       (type*)ma_realloc( sa, 
ptr, ((sz)*sizeof(type)), ((osz)*sizeof(type)))
-#define MA_STRDUP( sa, s)                              ma_strdup(sa, s)
-#define MA_STRNDUP( sa, s, l)                          ma_strndup(sa, s, l)
 
 
 #if !defined(NDEBUG) && !defined(__COVERITY__) && defined(__GNUC__) && 
!defined(_CLANGD)
diff --git a/gdk/gdk_atoms.c b/gdk/gdk_atoms.c
--- a/gdk/gdk_atoms.c
+++ b/gdk/gdk_atoms.c
@@ -428,7 +428,7 @@ ATOMformat(allocator *ma, int t, const v
                }
                return buf;
        }
-       return MA_STRDUP(ma, "nil");
+       return ma_strdup(ma, "nil");
 }
 
 ptr
diff --git a/gdk/gdk_value.c b/gdk/gdk_value.c
--- a/gdk/gdk_value.c
+++ b/gdk/gdk_value.c
@@ -290,7 +290,7 @@ VALformat(allocator *ma, const ValRecord
 {
        if (res->bat) {
                if (is_bat_nil(res->val.bval)) {
-                       return MA_STRDUP(ma, "nil");
+                       return ma_strdup(ma, "nil");
                }
                else
                        return ATOMformat(ma, TYPE_int, (const void *) 
&res->val.ival);
diff --git a/geom/monetdb5/geom.c b/geom/monetdb5/geom.c
--- a/geom/monetdb5/geom.c
+++ b/geom/monetdb5/geom.c
@@ -2372,11 +2372,11 @@ geoGetType(Client ctx, char **res, int *
 {
        allocator *ma = ctx->curprg->def->ma;
        if (is_int_nil(*info) || is_int_nil(*flag)) {
-               if ((*res = MA_STRDUP(ma, str_nil)) == NULL)
+               if ((*res = ma_strdup(ma, str_nil)) == NULL)
                        throw(MAL, "geom.getType", SQLSTATE(HY013) 
MAL_MALLOC_FAIL);
                return MAL_SUCCEED;
        }
-       if ((*res = MA_STRDUP(ma, geom_type2str(*info >> 2, *flag))) == NULL)
+       if ((*res = ma_strdup(ma, geom_type2str(*info >> 2, *flag))) == NULL)
                throw(MAL, "geom.getType", SQLSTATE(HY013) MAL_MALLOC_FAIL);
        return MAL_SUCCEED;
 }
@@ -2525,7 +2525,7 @@ wkbAsBinary(Client ctx, char **toStr, wk
        int i;
 
        if (is_wkb_nil(*geomWKB)) {
-               if ((*toStr = MA_STRDUP(ma, str_nil)) == NULL)
+               if ((*toStr = ma_strdup(ma, str_nil)) == NULL)
                        throw(MAL, "geom.AsBinary", SQLSTATE(HY013) 
MAL_MALLOC_FAIL);
                return MAL_SUCCEED;
        }
@@ -2721,7 +2721,7 @@ wkbAsText(Client ctx, char **txt, wkb **
        const char sridTxt[] = "SRID:";
 
        if (is_wkb_nil(*geomWKB) || (withSRID && is_int_nil(*withSRID))) {
-               if ((*txt = MA_STRDUP(ma, str_nil)) == NULL)
+               if ((*txt = ma_strdup(ma, str_nil)) == NULL)
                        throw(MAL, "geom.AsText", SQLSTATE(HY013) 
MAL_MALLOC_FAIL);
                return MAL_SUCCEED;
        }
@@ -4301,7 +4301,7 @@ wkbIsValidReason(Client ctx, char **reas
        char *GEOSReason = NULL;
 
        if (is_wkb_nil(*geomWKB)) {
-               if ((*reason = MA_STRDUP(ma, str_nil)) == NULL)
+               if ((*reason = ma_strdup(ma, str_nil)) == NULL)
                        throw(MAL, "geom.IsValidReason", SQLSTATE(HY013) 
MAL_MALLOC_FAIL);
                return MAL_SUCCEED;
        }
@@ -4317,7 +4317,7 @@ wkbIsValidReason(Client ctx, char **reas
        if (GEOSReason == NULL)
                throw(MAL, "geom.IsValidReason", SQLSTATE(38000) "Geos 
operation GEOSisValidReason failed");
 
-       *reason = MA_STRDUP(ma, GEOSReason);
+       *reason = ma_strdup(ma, GEOSReason);
        GEOSFree_r(geoshandle, GEOSReason);
        if (*reason == NULL)
                throw(MAL, "geom.IsValidReason", SQLSTATE(HY013) 
MAL_MALLOC_FAIL);
@@ -4336,7 +4336,7 @@ wkbIsValidDetail(Client ctx, char **out,
        GEOSGeom geosGeometry;
 
        if (is_wkb_nil(*geom)) {
-               if ((*out = MA_STRDUP(ma, str_nil)) == NULL)
+               if ((*out = ma_strdup(ma, str_nil)) == NULL)
                        throw(MAL, "geom.IsValidReason", SQLSTATE(HY013) 
MAL_MALLOC_FAIL);
                return MAL_SUCCEED;
        }
@@ -4354,7 +4354,7 @@ wkbIsValidDetail(Client ctx, char **out,
                throw(MAL, "geom.IsValidDetail", SQLSTATE(38000) "Geos 
operation GEOSisValidDetail failed");
        }
 
-       *out = MA_STRDUP(ma, GEOSreason);
+       *out = ma_strdup(ma, GEOSreason);
 
        GEOSFree_r(geoshandle, GEOSreason);
        GEOSGeom_destroy_r(geoshandle, GEOSlocation);
diff --git a/monetdb5/mal/mal_client.c b/monetdb5/mal/mal_client.c
--- a/monetdb5/mal/mal_client.c
+++ b/monetdb5/mal/mal_client.c
@@ -600,25 +600,25 @@ MCsetClientInfo(Client c, const char *pr
                case 'H':
                        if (strcasecmp(property, "ClientHostname") == 0) {
                                //GDKfree(c->client_hostname);
-                               c->client_hostname = value ? MA_STRDUP(c->ma, 
value) : NULL;
+                               c->client_hostname = value ? ma_strdup(c->ma, 
value) : NULL;
                        }
                        break;
                case 'A':
                        if (strcasecmp(property, "ApplicationName") == 0) {
                                //GDKfree(c->client_application);
-                               c->client_application = value ? 
MA_STRDUP(c->ma, value) : NULL;
+                               c->client_application = value ? 
ma_strdup(c->ma, value) : NULL;
                        }
                        break;
                case 'L':
                        if (strcasecmp(property, "ClientLibrary") == 0) {
                                //GDKfree(c->client_library);
-                               c->client_library = value ? MA_STRDUP(c->ma, 
value) : NULL;
+                               c->client_library = value ? ma_strdup(c->ma, 
value) : NULL;
                        }
                        break;
                case 'R':
                        if (strcasecmp(property, "ClientRemark") == 0) {
                                //GDKfree(c->client_remark);
-                               c->client_remark = value ? MA_STRDUP(c->ma, 
value) : NULL;
+                               c->client_remark = value ? ma_strdup(c->ma, 
value) : NULL;
                        }
                        break;
                case 'P':
diff --git a/monetdb5/mal/mal_dataflow.c b/monetdb5/mal/mal_dataflow.c
--- a/monetdb5/mal/mal_dataflow.c
+++ b/monetdb5/mal/mal_dataflow.c
@@ -338,7 +338,7 @@ DFLOWworker(void *T)
                        error = runMALsequence(flow->cntxt, flow->mb, fe->pc, 
fe->pc + 1,
                                                                   flow->stk, 
0, 0);
                        if (error)
-                               error = MA_STRDUP(flow->mb->ma, error);
+                               error = ma_strdup(flow->mb->ma, error);
                        ma_reset(ma);
 
                        ATOMIC_DEC(&flow->cntxt->workers);
diff --git a/monetdb5/mal/mal_exception.c b/monetdb5/mal/mal_exception.c
--- a/monetdb5/mal/mal_exception.c
+++ b/monetdb5/mal/mal_exception.c
@@ -323,7 +323,7 @@ getExceptionPlace(allocator *ma, const c
                        break;
                }
        }
-       return MA_STRDUP(ma, "(unknown)");
+       return ma_strdup(ma, "(unknown)");
 }
 
 /**
@@ -374,6 +374,6 @@ inline str
 copyException(allocator *ma, const char *exception)
 {
        if (exception)
-               return ma ? MA_STRDUP(ma, exception) : (char *)exception;
+               return ma ? ma_strdup(ma, exception) : (char *)exception;
        return NULL;
 }
diff --git a/monetdb5/mal/mal_function.c b/monetdb5/mal/mal_function.c
--- a/monetdb5/mal/mal_function.c
+++ b/monetdb5/mal/mal_function.c
@@ -679,7 +679,7 @@ chkDeclarations(MalBlkPtr mb)
        char name[IDLENGTH];
 
        if (mb->errors)
-               return MA_STRDUP(mb->ma, mb->errors);
+               return ma_strdup(mb->ma, mb->errors);
        blks[top] = blkId;
 
        /* initialize the scope */
diff --git a/monetdb5/mal/mal_instruction.c b/monetdb5/mal/mal_instruction.c
--- a/monetdb5/mal/mal_instruction.c
+++ b/monetdb5/mal/mal_instruction.c
@@ -35,7 +35,7 @@ addMalException(MalBlkPtr mb, str msg)
        if (mb->errors) {
                mb->errors = concatErrors(mb->ma, mb->errors, msg);
        } else {
-               mb->errors = MA_STRDUP(mb->ma, msg);
+               mb->errors = ma_strdup(mb->ma, msg);
        }
 }
 
@@ -355,7 +355,7 @@ copyMalBlk(MalBlkPtr old)
        for (i = 0; i < old->vtop; i++) {
                mb->var[i] = old->var[i];
                if (mb->var[i].name) {
-                       mb->var[i].name = MA_STRDUP(ma, mb->var[i].name);
+                       mb->var[i].name = ma_strdup(ma, mb->var[i].name);
                        if (!mb->var[i].name)
                                goto bailout;
                }
@@ -381,12 +381,12 @@ copyMalBlk(MalBlkPtr old)
                }
        }
        mb->stop = old->stop;
-       if (old->help && (mb->help = MA_STRDUP(mb->ma, old->help)) == NULL) {
+       if (old->help && (mb->help = ma_strdup(mb->ma, old->help)) == NULL) {
                goto bailout;
        }
 
        strcpy_len(mb->binding, old->binding, sizeof(mb->binding));
-       mb->errors = old->errors ? MA_STRDUP(mb->ma, old->errors) : 0;
+       mb->errors = old->errors ? ma_strdup(mb->ma, old->errors) : 0;
        mb->tag = old->tag;
        mb->runtime = old->runtime;
        mb->calls = old->calls;
@@ -704,7 +704,7 @@ cloneVariable(MalBlkPtr tm, MalBlkPtr mb
        else {
                res = newTmpVariable(tm, getVarType(mb, x));
                if (mb->var[x].name)
-                       tm->var[x].name = MA_STRDUP(tm->ma, mb->var[x].name);
+                       tm->var[x].name = ma_strdup(tm->ma, mb->var[x].name);
        }
        if (res < 0)
                return res;
diff --git a/monetdb5/mal/mal_type.c b/monetdb5/mal/mal_type.c
--- a/monetdb5/mal/mal_type.c
+++ b/monetdb5/mal/mal_type.c
@@ -42,7 +42,7 @@ getTypeName(allocator *ma, malType tpe)
        int k;
 
        if (tpe == TYPE_any)
-               return MA_STRDUP(ma, "any");
+               return ma_strdup(ma, "any");
        if (isaBatType(tpe)) {
                k = getTypeIndex(tpe);
                if (k)
@@ -51,13 +51,13 @@ getTypeName(allocator *ma, malType tpe)
                        snprintf(buf, sizeof(buf), "bat[:any]");
                else
                        snprintf(buf, sizeof(buf), "bat[:%s]", 
ATOMname(getBatType(tpe)));
-               return MA_STRDUP(ma, buf);
+               return ma_strdup(ma, buf);
        }
        if (isAnyExpression(tpe)) {
                snprintf(buf, sizeof(buf), "any_%d", getTypeIndex(tpe));
-               return MA_STRDUP(ma, buf);
+               return ma_strdup(ma, buf);
        }
-       return MA_STRDUP(ma, ATOMname(tpe));
+       return ma_strdup(ma, ATOMname(tpe));
 }
 
 /*
diff --git a/monetdb5/modules/atoms/inet.c b/monetdb5/modules/atoms/inet.c
--- a/monetdb5/modules/atoms/inet.c
+++ b/monetdb5/modules/atoms/inet.c
@@ -563,7 +563,7 @@ INEThost(Client ctx, str *retval, const 
        str ip;
 
        if (is_inet_nil(val)) {
-               *retval = MA_STRDUP(ma, str_nil);
+               *retval = ma_strdup(ma, str_nil);
                if (*retval == NULL)
                        throw(MAL, "INEThost", SQLSTATE(HY013) MAL_MALLOC_FAIL);
        } else {
@@ -722,7 +722,7 @@ INETtext(Client ctx, str *retval, const 
        str ip;
 
        if (is_inet_nil(val)) {
-               *retval = MA_STRDUP(ma, str_nil);
+               *retval = ma_strdup(ma, str_nil);
                if (*retval == NULL)
                        throw(MAL, "INETtext", SQLSTATE(HY013) MAL_MALLOC_FAIL);
        } else {
@@ -749,7 +749,7 @@ INETabbrev(Client ctx, str *retval, cons
        str ip;
 
        if (is_inet_nil(val)) {
-               *retval = MA_STRDUP(ma, str_nil);
+               *retval = ma_strdup(ma, str_nil);
                if (*retval == NULL)
                        throw(MAL, "inet.abbrev", SQLSTATE(HY013) 
MAL_MALLOC_FAIL);
        } else {
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
@@ -492,7 +492,7 @@ JSONjson2str(Client ctx, str *ret, json 
 
        if (*s == '"')
                s++;
-       if ((s = MA_STRDUP(ma, s)) == NULL)
+       if ((s = ma_strdup(ma, s)) == NULL)
                throw(MAL, "json.str", SQLSTATE(HY013) MAL_MALLOC_FAIL);
        c = s + strlen(s) - 1;
        if (*c == '"')
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to