Changeset: c0c81b8b4ab0 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/c0c81b8b4ab0
Modified Files:
        monetdb5/mal/mal_atom.c
        monetdb5/mal/mal_instruction.c
        monetdb5/mal/mal_module.c
        monetdb5/mal/mal_parser.c
        monetdb5/mal/mal_session.c
        monetdb5/mal/mal_type.h
        monetdb5/modules/mal/inspect.c
        monetdb5/optimizer/opt_querylog.c
Branch: default
Log Message:

Get rid of idcmp and just use strcmp.


diffs (203 lines):

diff --git a/monetdb5/mal/mal_atom.c b/monetdb5/mal/mal_atom.c
--- a/monetdb5/mal/mal_atom.c
+++ b/monetdb5/mal/mal_atom.c
@@ -42,81 +42,81 @@ malAtomProperty(mel_func *f)
        assert(f->imp != NULL);
        switch (name[0]) {
        case 'd':
-               if (idcmp("del", name) == 0 && f->argc == 1) {
+               if (strcmp("del", name) == 0 && f->argc == 1) {
                        BATatoms[tpe].atomDel = (void (*)(Heap *, var_t *)) 
f->imp;
                        return MAL_SUCCEED;
                }
                break;
        case 'c':
-               if (idcmp("cmp", name) == 0 && f->argc == 1) {
+               if (strcmp("cmp", name) == 0 && f->argc == 1) {
                        BATatoms[tpe].atomCmp = (int (*)(const void *, const 
void *)) f->imp;
                        BATatoms[tpe].linear = true;
                        return MAL_SUCCEED;
                }
                break;
        case 'f':
-               if (idcmp("fromstr", name) == 0 && f->argc == 1) {
+               if (strcmp("fromstr", name) == 0 && f->argc == 1) {
                        BATatoms[tpe].atomFromStr = (ssize_t (*)(const char *, 
size_t *, ptr *, bool)) f->imp;
                        return MAL_SUCCEED;
                }
                break;
        case 'h':
-               if (idcmp("heap", name) == 0 && f->argc == 1) {
+               if (strcmp("heap", name) == 0 && f->argc == 1) {
                        /* heap function makes an atom varsized */
                        BATatoms[tpe].size = sizeof(var_t);
                        assert_shift_width(ATOMelmshift(ATOMsize(tpe)), 
ATOMsize(tpe));
                        BATatoms[tpe].atomHeap = (gdk_return (*)(Heap *, 
size_t)) f->imp;
                        return MAL_SUCCEED;
                }
-               if (idcmp("hash", name) == 0 && f->argc == 1) {
+               if (strcmp("hash", name) == 0 && f->argc == 1) {
                        BATatoms[tpe].atomHash = (BUN (*)(const void *)) f->imp;
                        return MAL_SUCCEED;
                }
                break;
        case 'l':
-               if (idcmp("length", name) == 0 && f->argc == 1) {
+               if (strcmp("length", name) == 0 && f->argc == 1) {
                        BATatoms[tpe].atomLen = (size_t (*)(const void *)) 
f->imp;
                        return MAL_SUCCEED;
                }
                break;
        case 'n':
-               if (idcmp("null", name) == 0 && f->argc == 1) {
+               if (strcmp("null", name) == 0 && f->argc == 1) {
                        const void *atmnull = ((const void *(*)(void)) 
f->imp)();
 
                        BATatoms[tpe].atomNull = atmnull;
                        return MAL_SUCCEED;
                }
-               if (idcmp("nequal", name) == 0 && f->argc == 1) {
+               if (strcmp("nequal", name) == 0 && f->argc == 1) {
                        BATatoms[tpe].atomCmp = (int (*)(const void *, const 
void *)) f->imp;
                        return MAL_SUCCEED;
                }
                break;
        case 'p':
-               if (idcmp("put", name) == 0 && f->argc == 1) {
+               if (strcmp("put", name) == 0 && f->argc == 1) {
                        BATatoms[tpe].atomPut = (var_t (*)(BAT *, var_t *, 
const void *)) f->imp;
                        return MAL_SUCCEED;
                }
                break;
        case 's':
-               if (idcmp("storage", name) == 0 && f->argc == 1) {
+               if (strcmp("storage", name) == 0 && f->argc == 1) {
                        BATatoms[tpe].storage = (*(int (*)(void)) f->imp) ();
                        return MAL_SUCCEED;
                }
                break;
        case 't':
-               if (idcmp("tostr", name) == 0 && f->argc == 1) {
+               if (strcmp("tostr", name) == 0 && f->argc == 1) {
                        BATatoms[tpe].atomToStr = (ssize_t (*)(str *, size_t *, 
const void *, bool)) f->imp;
                        return MAL_SUCCEED;
                }
                break;
        case 'r':
-               if (idcmp("read", name) == 0 && f->argc == 1) {
+               if (strcmp("read", name) == 0 && f->argc == 1) {
                        BATatoms[tpe].atomRead = (void *(*)(void *, size_t *, 
stream *, size_t)) f->imp;
                        return MAL_SUCCEED;
                }
                break;
        case 'w':
-               if (idcmp("write", name) == 0 && f->argc == 1) {
+               if (strcmp("write", name) == 0 && f->argc == 1) {
                        BATatoms[tpe].atomWrite = (gdk_return (*)(const void *, 
stream *, size_t)) f->imp;
                        return MAL_SUCCEED;
                }
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
@@ -516,7 +516,7 @@ findVariable(MalBlkPtr mb, const char *n
        if (name == NULL)
                return -1;
        for (i = mb->vtop - 1; i >= 0; i--)
-               if (mb->var[i].name && idcmp(name, mb->var[i].name) == 0)
+               if (mb->var[i].name && strcmp(name, mb->var[i].name) == 0)
                        return i;
        return -1;
 }
diff --git a/monetdb5/mal/mal_module.c b/monetdb5/mal/mal_module.c
--- a/monetdb5/mal/mal_module.c
+++ b/monetdb5/mal/mal_module.c
@@ -328,7 +328,7 @@ insertSymbol(Module scope, Symbol prg)
        if (scope->space[t] != prg) {
                prg->peer = scope->space[t];
                scope->space[t] = prg;
-               if (prg->peer && idcmp(prg->name, prg->peer->name) == 0)
+               if (prg->peer && strcmp(prg->name, prg->peer->name) == 0)
                        prg->skip = prg->peer->skip;
                else
                        prg->skip = prg->peer;
@@ -419,7 +419,7 @@ findSymbolInModule(Module v, const char 
                return NULL;
        s = v->space[(int) (*fcn)];
        while (s != NULL) {
-               if (idcmp(s->name, fcn) == 0)
+               if (strcmp(s->name, fcn) == 0)
                        return s;
                s = s->skip;
        }
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
@@ -486,10 +486,6 @@ stringLength(Client cntxt)
        return l + 2;
 }
 
-/*Beware, the idcmp routine uses a short cast to compare multiple bytes
- * at once. This may cause problems when the net string length is zero.
-*/
-
 str
 strCopy(Client cntxt, int length)
 {
diff --git a/monetdb5/mal/mal_session.c b/monetdb5/mal/mal_session.c
--- a/monetdb5/mal/mal_session.c
+++ b/monetdb5/mal/mal_session.c
@@ -119,7 +119,7 @@ MSinitClientPrg(Client cntxt, const char
 {
        int idx;
 
-       if (cntxt->curprg && idcmp(nme, cntxt->curprg->name) == 0)
+       if (cntxt->curprg && strcmp(nme, cntxt->curprg->name) == 0)
                return MSresetClientPrg(cntxt, putName(mod), putName(nme));
        cntxt->curprg = newFunction(putName(mod), putName(nme), FUNCTIONsymbol);
        if (cntxt->curprg == 0)
diff --git a/monetdb5/mal/mal_type.h b/monetdb5/mal/mal_type.h
--- a/monetdb5/mal/mal_type.h
+++ b/monetdb5/mal/mal_type.h
@@ -63,7 +63,6 @@
 mal_export str getTypeName(malType tpe);
 mal_export str getTypeIdentifier(malType tpe);
 mal_export int getAtomIndex(const char *nme, size_t len, int deftpe);
-#define idcmp(n, m)    strcmp(n, m)
 mal_export int isIdentifier(str s);
 mal_export int findGDKtype(int type);  /* used in src/mal/mal_interpreter.c */
 
diff --git a/monetdb5/modules/mal/inspect.c b/monetdb5/modules/mal/inspect.c
--- a/monetdb5/modules/mal/inspect.c
+++ b/monetdb5/modules/mal/inspect.c
@@ -335,7 +335,7 @@ INSPECTgetSignature(Client cntxt, MalBlk
                throw(MAL, "inspect.getSignature", SQLSTATE(HY013) 
MAL_MALLOC_FAIL);
 
        while (s != NULL) {
-               if (idcmp(s->name, *fcn) == 0) {
+               if (strcmp(s->name, *fcn) == 0) {
                        InstrPtr p = getSignature(s);
                        char *c, *w;
 
@@ -388,7 +388,7 @@ INSPECTgetComment(Client cntxt, MalBlkPt
                throw(MAL, "inspect.getComment", SQLSTATE(HY013) 
MAL_MALLOC_FAIL);
 
        while (s != NULL) {
-               if (idcmp(s->name, *fcn) == 0 &&
+               if (strcmp(s->name, *fcn) == 0 &&
                        BUNappend(b, s->def->help, false) != GDK_SUCCEED)
                        goto bailout;
                s = s->peer;
diff --git a/monetdb5/optimizer/opt_querylog.c 
b/monetdb5/optimizer/opt_querylog.c
--- a/monetdb5/optimizer/opt_querylog.c
+++ b/monetdb5/optimizer/opt_querylog.c
@@ -142,8 +142,8 @@ OPTquerylogImplementation(Client cntxt, 
                p = old[i];
 
                if (getModuleId(p) == sqlRef
-                       && (idcmp(getFunctionId(p), "exportValue") == 0
-                               || idcmp(getFunctionId(p), "exportResult") == 
0)) {
+                       && (strcmp(getFunctionId(p), "exportValue") == 0
+                               || strcmp(getFunctionId(p), "exportResult") == 
0)) {
 
                        q = newStmt(mb, alarmRef, "usec");
                        if (q == NULL) {
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to