Changeset: f0e0f5cb23ba for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/f0e0f5cb23ba
Modified Files:
        monetdb5/mal/mal_parser.c
        monetdb5/mal/mal_session.c
        monetdb5/modules/atoms/blob.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/kernel/algebra.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/manifold.c
        monetdb5/modules/mal/remote.c
        monetdb5/modules/mal/tablet.c
        monetdb5/modules/mal/txtsim.c
        sql/backends/monet5/UDF/udf/udf.c
        sql/backends/monet5/sql_subquery.c
Branch: resource_management
Log Message:

favour MALblk allocator where possible


diffs (truncated from 4554 to 300 lines):

diff --git a/monetdb5/mal/mal_parser.c b/monetdb5/mal/mal_parser.c
--- a/monetdb5/mal/mal_parser.c
+++ b/monetdb5/mal/mal_parser.c
@@ -30,8 +30,8 @@
 #define FATALINPUT (MAXERRORS+1)
 #define NL(X) ((X)=='\n' || (X)=='\r')
 
-static str idCopy(allocator *ma, Client cntxt, int len);
-static str strCopy(allocator *va, Client cntxt, int len);
+static str idCopy(allocator *ma, Client ctx, int len);
+static str strCopy(allocator *va, Client ctx, int len);
 
 /*
  * For error reporting we may have to find the start of the previous line,
@@ -39,12 +39,12 @@ static str strCopy(allocator *va, Client
  * The remaining functions are self-explanatory.
 */
 static str
-lastline(Client cntxt)
+lastline(Client ctx)
 {
-       str s = CURRENT(cntxt);
+       str s = CURRENT(ctx);
        if (NL(*s))
                s++;
-       while (s > cntxt->fdin->buf && !NL(*s))
+       while (s > ctx->fdin->buf && !NL(*s))
                s--;
        if (NL(*s))
                s++;
@@ -52,10 +52,10 @@ lastline(Client cntxt)
 }
 
 static ssize_t
-position(Client cntxt)
+position(Client ctx)
 {
-       str s = lastline(cntxt);
-       return (ssize_t) (CURRENT(cntxt) - s);
+       str s = lastline(ctx);
+       return (ssize_t) (CURRENT(ctx) - s);
 }
 
 /*
@@ -63,35 +63,35 @@ position(Client cntxt)
  * or comment terminated by a new line
  */
 static inline void
-skipToEnd(Client cntxt)
+skipToEnd(Client ctx)
 {
        char c;
-       while ((c = *CURRENT(cntxt)) != ';' && c && c != '\n')
-               nextChar(cntxt);
+       while ((c = *CURRENT(ctx)) != ';' && c && c != '\n')
+               nextChar(ctx);
        if (c && c != '\n')
-               nextChar(cntxt);
+               nextChar(ctx);
 }
 
 /*
  * Keep on syntax error for reflection and correction.
  */
 static void
-parseError(allocator *ma, Client cntxt, str msg)
+parseError(allocator *ma, Client ctx, str msg)
 {
        MalBlkPtr mb;
        char *old, *new;
        char buf[1028] = { 0 };
        char *s = buf, *t, *line = "", *marker = "";
-       char *l = lastline(cntxt);
+       char *l = lastline(ctx);
        ssize_t i;
 
-       if (cntxt->backup) {
-               freeSymbol(cntxt->curprg);
-               cntxt->curprg = cntxt->backup;
-               cntxt->backup = 0;
+       if (ctx->backup) {
+               freeSymbol(ctx->curprg);
+               ctx->curprg = ctx->backup;
+               ctx->backup = 0;
        }
 
-       mb = cntxt->curprg->def;
+       mb = ctx->curprg->def;
        s = buf;
        for (t = l; *t && *t != '\n' && s < buf + sizeof(buf) - 4; t++) {
                *s++ = *t;
@@ -102,7 +102,7 @@ parseError(allocator *ma, Client cntxt, 
 
        /* produce the position marker */
        s = buf;
-       i = position(cntxt);
+       i = position(ctx);
        for (; i > 0 && s < buf + sizeof(buf) - 4; i--) {
                *s++ = ((l && *(l + 1) && *l++ != '\t')) ? ' ' : '\t';
        }
@@ -116,7 +116,7 @@ parseError(allocator *ma, Client cntxt, 
        if (new == NULL) {
                freeException(line);
                freeException(marker);
-               skipToEnd(cntxt);
+               skipToEnd(ctx);
                return;                                 // just stick to old 
error message
        }
        mb->errors = new;
@@ -129,7 +129,7 @@ parseError(allocator *ma, Client cntxt, 
 
        freeException(line);
        freeException(marker);
-       skipToEnd(cntxt);
+       skipToEnd(ctx);
 }
 
 /* Before a line is parsed we check for a request to echo it.
@@ -137,29 +137,29 @@ parseError(allocator *ma, Client cntxt, 
  * request and each time we encounter EOL.
 */
 static void
-echoInput(Client cntxt)
+echoInput(Client ctx)
 {
-       char *c = CURRENT(cntxt);
-       if (cntxt->listing == 1 && *c && !NL(*c)) {
-               mnstr_printf(cntxt->fdout, "#");
+       char *c = CURRENT(ctx);
+       if (ctx->listing == 1 && *c && !NL(*c)) {
+               mnstr_printf(ctx->fdout, "#");
                while (*c && !NL(*c)) {
-                       mnstr_printf(cntxt->fdout, "%c", *c++);
+                       mnstr_printf(ctx->fdout, "%c", *c++);
                }
-               mnstr_printf(cntxt->fdout, "\n");
+               mnstr_printf(ctx->fdout, "\n");
        }
 }
 
 static inline void
-skipSpace(Client cntxt)
+skipSpace(Client ctx)
 {
-       char *s = &currChar(cntxt);
+       char *s = &currChar(ctx);
        for (;;) {
                switch (*s++) {
                case ' ':
                case '\t':
                case '\n':
                case '\r':
-                       nextChar(cntxt);
+                       nextChar(ctx);
                        break;
                default:
                        return;
@@ -168,10 +168,10 @@ skipSpace(Client cntxt)
 }
 
 static inline void
-advance(Client cntxt, size_t length)
+advance(Client ctx, size_t length)
 {
-       cntxt->yycur += length;
-       skipSpace(cntxt);
+       ctx->yycur += length;
+       skipSpace(ctx);
 }
 
 /*
@@ -327,13 +327,13 @@ static const bool idCharacter2[256] = {
 };
 
 static int
-idLength(Client cntxt)
+idLength(Client ctx)
 {
        str s, t;
        int len = 0;
 
-       skipSpace(cntxt);
-       s = CURRENT(cntxt);
+       skipSpace(ctx);
+       s = CURRENT(ctx);
        t = s;
 
        if (!idCharacter[(unsigned char) (*s)])
@@ -356,13 +356,13 @@ idLength(Client cntxt)
 
 /* Simple type identifiers can not be marked with a type variable. */
 static size_t
-typeidLength(Client cntxt)
+typeidLength(Client ctx)
 {
        size_t l;
        char id[IDLENGTH], *t = id;
        str s;
-       skipSpace(cntxt);
-       s = CURRENT(cntxt);
+       skipSpace(ctx);
+       s = CURRENT(ctx);
 
        if (!idCharacter[(unsigned char) (*s)])
                return 0;
@@ -383,47 +383,47 @@ typeidLength(Client cntxt)
 }
 
 static str
-idCopy(allocator *ma, Client cntxt, int length)
+idCopy(allocator *ma, Client ctx, int length)
 {
        str s = ma_alloc(ma, length + 1);
        if (s == NULL)
                return NULL;
-       memcpy(s, CURRENT(cntxt), (size_t) length);
+       memcpy(s, CURRENT(ctx), (size_t) length);
        s[length] = 0;
        /* avoid a clash with old temporaries */
-       advance(cntxt, length);
+       advance(ctx, length);
        return s;
 }
 
 static int
-MALlookahead(Client cntxt, str kw, int length)
+MALlookahead(Client ctx, str kw, int length)
 {
        int i;
 
        /* avoid double test or use lowercase only. */
-       if (currChar(cntxt) == *kw &&
-               strncmp(CURRENT(cntxt), kw, length) == 0 &&
-               !idCharacter[(unsigned char) (CURRENT(cntxt)[length])] &&
-               !isdigit((unsigned char) (CURRENT(cntxt)[length]))) {
+       if (currChar(ctx) == *kw &&
+               strncmp(CURRENT(ctx), kw, length) == 0 &&
+               !idCharacter[(unsigned char) (CURRENT(ctx)[length])] &&
+               !isdigit((unsigned char) (CURRENT(ctx)[length]))) {
                return 1;
        }
        /* check for capitalized versions */
        for (i = 0; i < length; i++)
-               if (tolower(CURRENT(cntxt)[i]) != kw[i])
+               if (tolower(CURRENT(ctx)[i]) != kw[i])
                        return 0;
-       if (!idCharacter[(unsigned char) (CURRENT(cntxt)[length])] &&
-               !isdigit((unsigned char) (CURRENT(cntxt)[length]))) {
+       if (!idCharacter[(unsigned char) (CURRENT(ctx)[length])] &&
+               !isdigit((unsigned char) (CURRENT(ctx)[length]))) {
                return 1;
        }
        return 0;
 }
 
 static inline int
-MALkeyword(Client cntxt, str kw, int length)
+MALkeyword(Client ctx, str kw, int length)
 {
-       skipSpace(cntxt);
-       if (MALlookahead(cntxt, kw, length)) {
-               advance(cntxt, length);
+       skipSpace(ctx);
+       if (MALlookahead(ctx, kw, length)) {
+               advance(ctx, length);
                return 1;
        }
        return 0;
@@ -435,22 +435,22 @@ MALkeyword(Client cntxt, str kw, int len
 */
 
 static inline int
-keyphrase1(Client cntxt, str kw)
+keyphrase1(Client ctx, str kw)
 {
-       skipSpace(cntxt);
-       if (currChar(cntxt) == *kw) {
-               advance(cntxt, 1);
+       skipSpace(ctx);
+       if (currChar(ctx) == *kw) {
+               advance(ctx, 1);
                return 1;
        }
        return 0;
 }
 
 static inline int
-keyphrase2(Client cntxt, str kw)
+keyphrase2(Client ctx, str kw)
 {
-       skipSpace(cntxt);
-       if (CURRENT(cntxt)[0] == kw[0] && CURRENT(cntxt)[1] == kw[1]) {
-               advance(cntxt, 2);
+       skipSpace(ctx);
+       if (CURRENT(ctx)[0] == kw[0] && CURRENT(ctx)[1] == kw[1]) {
+               advance(ctx, 2);
                return 1;
        }
        return 0;
@@ -464,13 +464,13 @@ keyphrase2(Client cntxt, str kw)
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to