Changeset: f0401f48cbc9 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=f0401f48cbc9
Modified Files:
        clients/Tests/exports.stable.out
        monetdb5/mal/mal_builder.c
        monetdb5/mal/mal_builder.h
        monetdb5/optimizer/opt_querylog.c
        sql/backends/monet5/sql_gencode.c
Branch: default
Log Message:

Removed newStmt1 and newStmt2 since they were identical to newStmt.


diffs (truncated from 731 to 300 lines):

diff --git a/clients/Tests/exports.stable.out b/clients/Tests/exports.stable.out
--- a/clients/Tests/exports.stable.out
+++ b/clients/Tests/exports.stable.out
@@ -2299,9 +2299,7 @@ Plant newPlant(MalBlkPtr mb);
 InstrPtr newRaiseStmt(MalBlkPtr mb, str nme);
 str newRef;
 InstrPtr newReturnStmt(MalBlkPtr mb);
-InstrPtr newStmt(MalBlkPtr mb, char *module, char *name);
-InstrPtr newStmt1(MalBlkPtr mb, str module, char *name);
-InstrPtr newStmt2(MalBlkPtr mb, str module, char *name);
+InstrPtr newStmt(MalBlkPtr mb, const char *module, const char *name);
 Symbol newSymbol(str nme, int kind);
 int newTmpSink(MalBlkPtr mb, malType type);
 int newTmpVariable(MalBlkPtr mb, malType type);
diff --git a/monetdb5/mal/mal_builder.c b/monetdb5/mal/mal_builder.c
--- a/monetdb5/mal/mal_builder.c
+++ b/monetdb5/mal/mal_builder.c
@@ -40,51 +40,7 @@ newAssignment(MalBlkPtr mb)
 }
 
 InstrPtr
-newStmt(MalBlkPtr mb, char *module, char *name)
-{
-       InstrPtr q = newInstruction(mb,ASSIGNsymbol);
-
-       if (q == NULL)
-               return NULL;
-       setModuleId(q, putName(module, strlen(module)));
-       setFunctionId(q, putName(name, strlen(name)));
-       setDestVar(q, newTmpVariable(mb, TYPE_any));
-       if (getDestVar(q) < 0) {
-               freeInstruction(q);
-               return NULL;
-       }
-       pushInstruction(mb, q);
-       if (mb->errors) {
-               freeInstruction(q);
-               return NULL;
-       }
-       return q;
-}
-
-InstrPtr
-newStmt1(MalBlkPtr mb, str module, char *name)
-{
-       InstrPtr q = newInstruction(mb,ASSIGNsymbol);
-
-       if (q == NULL)
-               return NULL;
-       setModuleId(q, putName(module, strlen(module)));
-       setFunctionId(q, putName(name, strlen(name)));
-       setDestVar(q, newTmpVariable(mb, TYPE_any));
-       if (getDestVar(q) < 0) {
-               freeInstruction(q);
-               return NULL;
-       }
-       pushInstruction(mb, q);
-       if (mb->errors) {
-               freeInstruction(q);
-               return NULL;
-       }
-       return q;
-}
-
-InstrPtr
-newStmt2(MalBlkPtr mb, str module, char *name)
+newStmt(MalBlkPtr mb, const char *module, const char *name)
 {
        InstrPtr q = newInstruction(mb,ASSIGNsymbol);
 
diff --git a/monetdb5/mal/mal_builder.h b/monetdb5/mal/mal_builder.h
--- a/monetdb5/mal/mal_builder.h
+++ b/monetdb5/mal/mal_builder.h
@@ -12,9 +12,7 @@
 #include "mal.h"
 #include "mal_instruction.h"
 
-mal_export InstrPtr newStmt(MalBlkPtr mb, char *module, char *name);
-mal_export InstrPtr newStmt1(MalBlkPtr mb, str module, char *name);
-mal_export InstrPtr newStmt2(MalBlkPtr mb, str module, char *name);
+mal_export InstrPtr newStmt(MalBlkPtr mb, const char *module, const char 
*name);
 mal_export InstrPtr newAssignment(MalBlkPtr mb);
 mal_export InstrPtr newComment(MalBlkPtr mb, const char *val);
 mal_export InstrPtr newCatchStmt(MalBlkPtr mb, str nme);
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
@@ -61,7 +61,7 @@ OPTquerylogImplementation(Client cntxt, 
        defineQuery = pushArgument(mb,defineQuery,start);
        pushInstruction(mb, defineQuery);
 
-       q = newStmt1(mb, sqlRef, "argRecord");
+       q = newStmt(mb, sqlRef, "argRecord");
        for ( argc=1; argc < old[0]->argc; argc++)
                q = pushArgument(mb, q, getArg(old[0],argc));
 
@@ -94,7 +94,7 @@ OPTquerylogImplementation(Client cntxt, 
                         idcmp(getFunctionId(p),"exportResult")==0  ) ) {
 
                        q = newStmt(mb, "alarm", "usec");
-                       r = newStmt1(mb, calcRef, "-");
+                       r = newStmt(mb, calcRef, "-");
                        r = pushArgument(mb, r, getArg(q,0));
                        r = pushArgument(mb, r, xtime);
                        getArg(r,0)=xtime;
@@ -114,7 +114,7 @@ OPTquerylogImplementation(Client cntxt, 
                if ( p->token== ENDsymbol || p->barrier == RETURNsymbol || 
p->barrier == YIELDsymbol){
                        if ( rtime == 0){
                                q = newStmt(mb, "alarm", "usec");
-                               r = newStmt1(mb, calcRef, "-");
+                               r = newStmt(mb, calcRef, "-");
                                r = pushArgument(mb, r, getArg(q,0));
                                r = pushArgument(mb, r, xtime);
                                getArg(r,0)=xtime;
@@ -122,7 +122,7 @@ OPTquerylogImplementation(Client cntxt, 
                                rtime= getArg(q,0)= 
newVariable(mb,GDKstrdup("rtime"),TYPE_lng);
                        }
                        q = newStmt(mb, "alarm", "usec");
-                       r = newStmt1(mb, calcRef, "-");
+                       r = newStmt(mb, calcRef, "-");
                        r = pushArgument(mb, r, getArg(q,0));
                        r = pushArgument(mb, r, rtime);
                        getArg(r,0)=rtime;
@@ -161,7 +161,7 @@ OPTquerylogImplementation(Client cntxt, 
                        /* the factory yield may return */
                        q = newStmt(mb, "mtime", "current_timestamp");
                        start= getArg(q,0)= 
newVariable(mb,GDKstrdup("start"),TYPE_any);
-                       q = newStmt1(mb, sqlRef, "argRecord");
+                       q = newStmt(mb, sqlRef, "argRecord");
                        for ( argc=1; argc < old[0]->argc; argc++)
                                q = pushArgument(mb, q, getArg(old[0],argc));
                        arg= getArg(q,0)= 
newVariable(mb,GDKstrdup("args"),TYPE_str);
diff --git a/sql/backends/monet5/sql_gencode.c 
b/sql/backends/monet5/sql_gencode.c
--- a/sql/backends/monet5/sql_gencode.c
+++ b/sql/backends/monet5/sql_gencode.c
@@ -287,7 +287,7 @@ dump_table(MalBlkPtr mb, sql_table *t)
 {
        int nr;
        node *n;
-       InstrPtr k = newStmt1(mb, sqlRef, "declaredTable");
+       InstrPtr k = newStmt(mb, sqlRef, "declaredTable");
 
        nr = getDestVar(k);
        k = pushStr(mb, k, t->base.name);
@@ -302,7 +302,7 @@ dump_table(MalBlkPtr mb, sql_table *t)
 
                if (tn == NULL)
                        return -1;
-               q = newStmt1(mb, sqlRef, "dtColumn");
+               q = newStmt(mb, sqlRef, "dtColumn");
                q = pushArgument(mb, q, nr);
                q = pushStr(mb, q, tn);
                q = pushStr(mb, q, cn);
@@ -319,7 +319,7 @@ dump_table(MalBlkPtr mb, sql_table *t)
 static int
 drop_table(MalBlkPtr mb, str n)
 {
-       InstrPtr k = newStmt1(mb, sqlRef, "dropDeclaredTable");
+       InstrPtr k = newStmt(mb, sqlRef, "dropDeclaredTable");
        int nr = getDestVar(k);
 
        k = pushStr(mb, k, n);
@@ -786,7 +786,7 @@ static int
 {
        InstrPtr q;
 
-       q = newStmt2(mb, mod, name);
+       q = newStmt(mb, mod, name);
        q = pushArgument(mb, q, o1);
        if (q == NULL)
                return -1;
@@ -809,7 +809,7 @@ static int
 {
        InstrPtr q;
 
-       q = newStmt2(mb, mod, name);
+       q = newStmt(mb, mod, name);
        q = pushArgument(mb, q, o1);
        q = pushArgument(mb, q, o2);
        if (q == NULL)
@@ -842,7 +842,7 @@ dump_2_(backend *sql, MalBlkPtr mb, stmt
        if ((o2 = _dumpstmt(sql, mb, s->op2)) < 0)
                return -1;
 
-       q = newStmt1(mb, mod, name);
+       q = newStmt(mb, mod, name);
        q = pushArgument(mb, q, o1);
        q = pushArgument(mb, q, o2);
        if (q == NULL)
@@ -970,7 +970,7 @@ static int
                                if (VAR_GLOBAL(s->flag)) {      /* globals */
                                        int tt = tail_type(s)->type->localtype;
 
-                                       q = newStmt1(mb, sqlRef, "getVariable");
+                                       q = newStmt(mb, sqlRef, "getVariable");
                                        q = pushArgument(mb, q, sql->mvc_var);
                                        q = pushStr(mb, q, 
s->op1->op4.aval->data.val.sval);
                                        if (q == NULL)
@@ -1039,7 +1039,7 @@ static int
 
                        if (val < 0)
                                return -1;
-                       q = newStmt1(mb, sqlRef, "single");
+                       q = newStmt(mb, sqlRef, "single");
                        if (q == NULL)
                                return -1;
                        setVarType(mb, getArg(q, 0), newBatType(TYPE_oid, tt));
@@ -1051,7 +1051,7 @@ static int
                case st_temp:{
                        int tt = s->op4.typeval.type->localtype;
 
-                       q = newStmt1(mb, batRef, "new");
+                       q = newStmt(mb, batRef, "new");
                        if (q == NULL)
                                return -1;
                        setVarType(mb, getArg(q, 0), newBatType(TYPE_oid, tt));
@@ -1067,7 +1067,7 @@ static int
                        int tt = TYPE_oid;
                        sql_table *t = s->op4.tval;
 
-                       q = newStmt1(mb, sqlRef, "tid");
+                       q = newStmt(mb, sqlRef, "tid");
                        if (q == NULL)
                                return -1;
                        setVarType(mb, getArg(q, 0), newBatType(TYPE_oid, tt));
@@ -1092,7 +1092,7 @@ static int
                        sql_column *c = s->op4.cval;
                        sql_table *t = c->t;
 
-                       q = newStmt2(mb, sqlRef, bindRef);
+                       q = newStmt(mb, sqlRef, bindRef);
                        if (q == NULL)
                                return -1;
                        if (s->flag == RD_UPD_ID) {
@@ -1131,7 +1131,7 @@ static int
                        sql_idx *i = s->op4.idxval;
                        sql_table *t = i->t;
 
-                       q = newStmt2(mb, sqlRef, bindidxRef);
+                       q = newStmt(mb, sqlRef, bindidxRef);
                        if (q == NULL)
                                return -1;
                        if (s->flag == RD_UPD_ID) {
@@ -1211,7 +1211,7 @@ static int
                                int tt = tail_type(s->op1)->type->localtype;
 
                                assert(0);
-                               q = newStmt1(mb, batRef, "new");
+                               q = newStmt(mb, batRef, "new");
                                if (q == NULL)
                                        return -1;
                                setVarType(mb, getArg(q, 0), 
newBatType(TYPE_oid, tt));
@@ -1222,7 +1222,7 @@ static int
                                        return -1;
                                k = getDestVar(q);
 
-                               q = newStmt2(mb, batRef, appendRef);
+                               q = newStmt(mb, batRef, appendRef);
                                q = pushArgument(mb, q, k);
                                q = pushArgument(mb, q, c);
                                if (q == NULL)
@@ -1235,7 +1235,7 @@ static int
                                int dir = (flag & 4);
                                int distinct = (flag & 8);
 
-                               q = newStmt1(mb, calcRef, "+");
+                               q = newStmt(mb, calcRef, "+");
                                q = pushArgument(mb, q, offset);
                                q = pushArgument(mb, q, len);
                                if (q == NULL)
@@ -1261,7 +1261,7 @@ static int
                                        renameVariable(mb, getArg(q, 1), 
"r1_%d", s->nr);
                                l = getDestVar(q);
                        } else {
-                               q = newStmt1(mb, calcRef, "+");
+                               q = newStmt(mb, calcRef, "+");
                                q = pushArgument(mb, q, offset);
                                q = pushArgument(mb, q, len);
                                if (q == NULL)
@@ -1271,14 +1271,14 @@ static int
                                /* since both arguments of algebra.subslice are
                                   inclusive correct the LIMIT value by
                                   subtracting 1 */
-                               q = newStmt1(mb, calcRef, "-");
+                               q = newStmt(mb, calcRef, "-");
                                q = pushArgument(mb, q, len);
                                q = pushInt(mb, q, 1);
                                if (q == NULL)
                                        return -1;
                                len = getDestVar(q);
 
-                               q = newStmt1(mb, algebraRef, "subslice");
+                               q = newStmt(mb, algebraRef, "subslice");
                                q = pushArgument(mb, q, c);
                                q = pushArgument(mb, q, offset);
                                q = pushArgument(mb, q, len);
@@ -1288,7 +1288,7 @@ static int
                        }
                        /* retrieve the single values again */
                        if (s->nrcols == 0) {
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to