Changeset: 2db6f10c3129 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/2db6f10c3129 Modified Files: monetdb5/modules/atoms/batxml.c monetdb5/modules/atoms/blob.c monetdb5/modules/atoms/identifier.c monetdb5/modules/atoms/inet.c monetdb5/modules/atoms/json.c monetdb5/modules/atoms/mtime.c monetdb5/modules/atoms/streams.c monetdb5/modules/atoms/url.c monetdb5/modules/atoms/uuid.c monetdb5/modules/atoms/xml.c monetdb5/modules/atoms/xml.h monetdb5/modules/kernel/bat5.c monetdb5/modules/kernel/batmmath.c monetdb5/modules/kernel/batstr.c monetdb5/modules/kernel/microbenchmark.c monetdb5/modules/mal/batExtensions.c monetdb5/modules/mal/bbp.c monetdb5/modules/mal/calc.c monetdb5/modules/mal/clients.c monetdb5/modules/mal/inspect.c monetdb5/modules/mal/iterator.c monetdb5/modules/mal/mal_io.c monetdb5/modules/mal/mal_mapi.c monetdb5/modules/mal/mdb.c monetdb5/modules/mal/profiler.c monetdb5/modules/mal/querylog.c monetdb5/modules/mal/remote.c monetdb5/modules/mal/tracer.c Branch: Dec2023 Log Message:
Use const for arguments of MAL implementation functions. diffs (truncated from 3505 to 300 lines): diff --git a/monetdb5/modules/atoms/batxml.c b/monetdb5/modules/atoms/batxml.c --- a/monetdb5/modules/atoms/batxml.c +++ b/monetdb5/modules/atoms/batxml.c @@ -759,7 +759,7 @@ BATXMLroot(bat *ret, const bat *bid, con *standalone); snprintf(buf + i, len - i, "?>%s", t + 1); buf++; - XMLisdocument(&isdoc, &buf); /* check well-formedness */ + XMLisdocument(&isdoc, &(const char *){buf}); /* check well-formedness */ buf--; if (!isdoc) { err = XML_NOT_WELL_FORMED; diff --git a/monetdb5/modules/atoms/blob.c b/monetdb5/modules/atoms/blob.c --- a/monetdb5/modules/atoms/blob.c +++ b/monetdb5/modules/atoms/blob.c @@ -130,7 +130,7 @@ BLOBnitems_bulk(Client cntxt, MalBlkPtr } static str -BLOBtoblob(blob **retval, str *s) +BLOBtoblob(blob **retval, const char *const *s) { size_t len = strLen(*s); blob *b = (blob *) GDKmalloc(blobsize(len)); @@ -144,7 +144,7 @@ BLOBtoblob(blob **retval, str *s) } static str -BLOBblob_blob(blob **d, blob **s) +BLOBblob_blob(blob **d, const blob *const*s) { size_t len = blobsize((*s)->nitems); blob *b; @@ -238,7 +238,7 @@ BLOBblob_blob_bulk(bat *res, const bat * } static str -BLOBblob_fromstr(blob **b, const char **s) +BLOBblob_fromstr(blob **b, const char *const*s) { size_t len = 0; 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 @@ -93,7 +93,7 @@ IDtoString(char **retval, size_t *len, c * to parse the string. */ static str -IDentifier(identifier *retval, str *in) +IDentifier(identifier *retval, const char *const *in) { size_t len = 0; 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 @@ -229,7 +229,7 @@ INETtoString(str *retval, size_t *len, c * to parse the string. */ static str -INETnew(inet *retval, str *in) +INETnew(inet *retval, const char *const *in) { ssize_t pos; size_t len = sizeof(inet); @@ -787,7 +787,7 @@ INET_inet(inet *d, const inet *s) } static str -INET_fromstr(inet *ret, str *s) +INET_fromstr(inet *ret, const char *const *s) { size_t len = sizeof(inet); if (INETfromString(*s, &len, (void **) &ret, false) < 0) 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 @@ -233,7 +233,7 @@ JSONtoStorageString(JSON *jt, int idx, j return msg; } -static str JSONstr2json(json *ret, const char **j); +static str JSONstr2json(json *ret, const char *const*j); static ssize_t JSONfromString(const char *src, size_t *len, void **J, bool external) @@ -338,7 +338,7 @@ JSONtoString(str *s, size_t *len, const } static BAT * -JSONdumpInternal(JSON *jt, int depth) +JSONdumpInternal(const JSON *jt, int depth) { int i, idx; JSONterm *je; @@ -464,7 +464,7 @@ JSONdump(Client cntxt, MalBlkPtr mb, Mal (void) cntxt; bat *ret = getArgReference_bat(stk, pci, 0); - json *val = (json *) getArgReference(stk, pci, 1); + const json *val = (json *) getArgReference(stk, pci, 1); JSON *jt = JSONparse(*val); CHECK_JSON(jt); @@ -503,7 +503,7 @@ JSON2json(json *ret, const json *j) } static str -JSONstr2json(json *ret, const char **j) +JSONstr2json(json *ret, const char *const*j) { str msg = MAL_SUCCEED; json buf = NULL; @@ -541,7 +541,7 @@ JSONstr2json(json *ret, const char **j) } static str -JSONisvalid(bit *ret, str *j) +JSONisvalid(bit *ret, const char *const *j) { if (strNil(*j)) { *ret = bit_nil; @@ -556,12 +556,12 @@ JSONisvalid(bit *ret, str *j) } static str -JSONisobject(bit *ret, json *js) +JSONisobject(bit *ret, const json *js) { if (strNil(*js)) { *ret = bit_nil; } else { - char *j = *js; + const char *j = *js; skipblancs(j); *ret = *j == '{'; @@ -570,12 +570,12 @@ JSONisobject(bit *ret, json *js) } static str -JSONisarray(bit *ret, json *js) +JSONisarray(bit *ret, const json *js) { if (strNil(*js)) { *ret = bit_nil; } else { - char *j = *js; + const char *j = *js; skipblancs(j); *ret = *j == '['; @@ -604,7 +604,7 @@ jsonRead(str a, size_t *dstlen, stream * if ((a = BATatoms[TYPE_str].atomRead(a, dstlen, s, cnt)) == NULL) return NULL; - if ((msg = JSONstr2json(&out, (const char **) &a)) != MAL_SUCCEED) { + if ((msg = JSONstr2json(&out, &(const char *){a})) != MAL_SUCCEED) { freeException(msg); GDKfree(a); return NULL; @@ -612,9 +612,7 @@ jsonRead(str a, size_t *dstlen, stream * *dstlen = strlen(out) + 1; GDKfree(a); - a = out; - - return a; + return out; } #endif @@ -714,10 +712,10 @@ typedef struct { } pattern; static str -JSONcompile(char *expr, pattern terms[]) +JSONcompile(const char *expr, pattern terms[]) { int t = 0; - char *s, *beg; + const char *s, *beg; for (s = expr; *s; s++) { terms[t].token = CHILD_STEP; @@ -801,7 +799,7 @@ JSONcompile(char *expr, pattern terms[]) } static str -JSONgetValue(JSON *jt, int idx) +JSONgetValue(const JSON *jt, int idx) { str s; @@ -842,7 +840,7 @@ JSONglue(str res, str r, char sep) /* return NULL on no match, return (str) -1 on (malloc) failure, (str) -2 on stack overflow */ static str -JSONmatch(JSON *jt, int ji, pattern *terms, int ti, bool accumulate) +JSONmatch(JSON *jt, int ji, const pattern *terms, int ti, bool accumulate) { str r = NULL, res = NULL; int i; @@ -954,7 +952,7 @@ JSONmatch(JSON *jt, int ji, pattern *ter } static str -JSONfilterInternal(json *ret, json *js, str *expr, str other) +JSONfilterInternal(json *ret, const json *js, const char *const *expr, const char *other) { pattern terms[MAXTERMS]; int tidx = 0; @@ -1491,7 +1489,7 @@ JSONparse(const char *j) } static str -JSONlength(int *ret, json *j) +JSONlength(int *ret, const json *j) { int i, cnt = 0; JSON *jt; @@ -1511,7 +1509,7 @@ JSONlength(int *ret, json *j) } static str -JSONfilterArrayDefault(json *ret, json *js, lng index, str other) +JSONfilterArrayDefault(json *ret, const json *js, lng index, const char *other) { char expr[BUFSIZ], *s = expr; @@ -1519,11 +1517,11 @@ JSONfilterArrayDefault(json *ret, json * throw(MAL, "json.filter", SQLSTATE(42000) "Filter index cannot be negative"); snprintf(expr, BUFSIZ, "[" LLFMT "]", index); - return JSONfilterInternal(ret, js, &s, other); + return JSONfilterInternal(ret, js, &(const char *){s}, other); } static str -JSONfilterArray_bte(json *ret, json *js, bte *index) +JSONfilterArray_bte(json *ret, const json *js, const bte *index) { if (strNil(*js) || is_bte_nil(*index)) { if (!(*ret = GDKstrdup(str_nil))) @@ -1534,7 +1532,7 @@ JSONfilterArray_bte(json *ret, json *js, } static str -JSONfilterArrayDefault_bte(json *ret, json *js, bte *index, str *other) +JSONfilterArrayDefault_bte(json *ret, const json *js, const bte *index, const char *const *other) { if (strNil(*js) || is_bte_nil(*index) || strNil(*other)) { if (!(*ret = GDKstrdup(str_nil))) @@ -1545,7 +1543,7 @@ JSONfilterArrayDefault_bte(json *ret, js } static str -JSONfilterArray_sht(json *ret, json *js, sht *index) +JSONfilterArray_sht(json *ret, const json *js, const sht *index) { if (strNil(*js) || is_sht_nil(*index)) { if (!(*ret = GDKstrdup(str_nil))) @@ -1556,7 +1554,7 @@ JSONfilterArray_sht(json *ret, json *js, } static str -JSONfilterArrayDefault_sht(json *ret, json *js, sht *index, str *other) +JSONfilterArrayDefault_sht(json *ret, const json *js, const sht *index, const char *const *other) { if (strNil(*js) || is_sht_nil(*index) || strNil(*other)) { if (!(*ret = GDKstrdup(str_nil))) @@ -1567,7 +1565,7 @@ JSONfilterArrayDefault_sht(json *ret, js } static str -JSONfilterArray_int(json *ret, json *js, int *index) +JSONfilterArray_int(json *ret, const json *js, const int *index) { if (strNil(*js) || is_int_nil(*index)) { if (!(*ret = GDKstrdup(str_nil))) @@ -1578,7 +1576,7 @@ JSONfilterArray_int(json *ret, json *js, } static str -JSONfilterArrayDefault_int(json *ret, json *js, int *index, str *other) +JSONfilterArrayDefault_int(json *ret, const json *js, const int *index, const char *const *other) { if (strNil(*js) || is_int_nil(*index) || strNil(*other)) { if (!(*ret = GDKstrdup(str_nil))) @@ -1589,7 +1587,7 @@ JSONfilterArrayDefault_int(json *ret, js } static str -JSONfilterArray_lng(json *ret, json *js, lng *index) +JSONfilterArray_lng(json *ret, const json *js, const lng *index) { if (strNil(*js) || is_lng_nil(*index)) { if (!(*ret = GDKstrdup(str_nil))) @@ -1600,7 +1598,7 @@ JSONfilterArray_lng(json *ret, json *js, _______________________________________________ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org