Changeset: ab662699300b for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=ab662699300b
Modified Files:
        gdk/gdk_atoms.mx
        gdk/gdk_batop.mx
        gdk/gdk_rangejoin.mx
        monetdb5/mal/mal_atom.c
        monetdb5/mal/mal_function.c
        monetdb5/mal/mal_interpreter.mx
        monetdb5/mal/mal_parser.mx
        monetdb5/modules/kernel/aggr_be_count.mx
        monetdb5/modules/kernel/aggr_be_minmax.mx
        monetdb5/modules/kernel/aggr_bge_count.mx
        monetdb5/modules/kernel/aggr_bge_minmax.mx
        sql/backends/monet5/sql_scenario.c
        sql/common/sql_types.c
        sql/server/rel_dump.c
        sql/server/rel_exp.c
        sql/server/rel_optimizer.c
        sql/server/rel_prop.c
        sql/server/rel_select.c
        sql/server/sql_statement.c
        sql/storage/store.c
Branch: default
Log Message:

Merge with Dec2011 branch.


diffs (truncated from 1172 to 300 lines):

diff --git a/clients/mapiclient/mclient.c b/clients/mapiclient/mclient.c
--- a/clients/mapiclient/mclient.c
+++ b/clients/mapiclient/mclient.c
@@ -2878,9 +2878,10 @@ main(int argc, char **argv)
                           current `c' is based on and see if we recognize
                           it: if -? or --help, exit with 0, else with -1 */
                        usage(argv[0], strcmp(argv[optind - 1], "-?") == 0 || 
strcmp(argv[optind - 1], "--help") == 0 ? 0 : -1);
-                       break;
+                       /* not reached */
                default:
                        usage(argv[0], -1);
+                       /* not reached */
                }
        }
 #ifdef HAVE_ICONV
diff --git a/clients/odbc/driver/ODBCConvert.c 
b/clients/odbc/driver/ODBCConvert.c
--- a/clients/odbc/driver/ODBCConvert.c
+++ b/clients/odbc/driver/ODBCConvert.c
@@ -1894,7 +1894,7 @@ ODBCFetch(ODBCStmt *stmt,
                        addStmtError(stmt, "07006", NULL, 0);
                        return SQL_ERROR;
                }
-               break;
+               /* break;  -- not reached */
        case SQL_C_BIT:
                if (ardrec && row > 0)
                        ptr = (SQLPOINTER) ((char *) ptr + row * (bind_type == 
SQL_BIND_BY_COLUMN ? sizeof(unsigned char) : bind_type));
diff --git a/gdk/gdk_atoms.mx b/gdk/gdk_atoms.mx
--- a/gdk/gdk_atoms.mx
+++ b/gdk/gdk_atoms.mx
@@ -1007,17 +1007,16 @@ int
 
        @:atommem(@1,sizeof(@1))@
        while (GDKisspace(*p))
-               p++; 
+               p++;
        if (p[0] == 'n' && p[1] == 'i' && p[2] == 'l') {
                **dst = @1_nil;
                p += 3;
        } else {
                if (!num10(*p) ) {
-                       if ( *p == '-') {
+                       if (*p == '-') {
                                sign = -1;
                                p++;
-                       } else
-                       if ( *p == '+') {
+                       } else if (*p == '+') {
                                p++;
                        } else {
                                /* all else is an error */
@@ -1034,10 +1033,13 @@ int
                if (p - q > @2 || (p - q == @2 && strncmp(q, "@3", @2) > 0)){
                        **dst = @1_nil;
                        sign = -1;
-               } else sign = 1;
-               if (p[0] == 'L' && p[1] == 'L' && sizeof(@1) == 8) {
+               } else
+                       sign = 1;
+#if @4 == 8
+               if (p[0] == 'L' && p[1] == 'L') {
                        p += 2;
                }
+#endif
        }
        return sign * (int) (p - src);
 }
@@ -1057,19 +1059,19 @@ static int @1Write(@1 *a, stream *s, siz
 @
 @c
 
-@:numfromstr(bte,3,127)@
+@:numfromstr(bte,3,127,1)@
 @:atomtostr(bte,"%hhd",bte)@
 @:atom_io(bte,Bte,bte)@
 
-@:numfromstr(sht,5,32767)@
+@:numfromstr(sht,5,32767,2)@
 @:atomtostr(sht,"%hd",sht)@
 @:atom_io(sht,Sht,sht)@
 
-@:numfromstr(int,10,2147483647)@
+@:numfromstr(int,10,2147483647,SIZEOF_INT)@
 @:atomtostr(int,"%d",int)@
 @:atom_io(int,Int,int)@
 
-@:numfromstr(lng,19,9223372036854775807)@
+@:numfromstr(lng,19,9223372036854775807,SIZEOF_LNG)@
 @:atomtostr(lng,LLFMT,lng)@
 
 @:atom_io(lng,Lng,lng)@
diff --git a/gdk/gdk_batop.mx b/gdk/gdk_batop.mx
--- a/gdk/gdk_batop.mx
+++ b/gdk/gdk_batop.mx
@@ -1543,7 +1543,6 @@ BATsample(BAT *b, BUN size)
                        }
                }
        }
-       break;
 @
 @c
 BAT *
diff --git a/gdk/gdk_rangejoin.mx b/gdk/gdk_rangejoin.mx
--- a/gdk/gdk_rangejoin.mx
+++ b/gdk/gdk_rangejoin.mx
@@ -328,11 +328,11 @@ break;
                        BUN g = MAX(ll-lp, 1024*1024);
                        BATsetcount(bn, o);
                        if (limit) {
-                              *limit = o * 
(lc<rc)?((rp-rc)/MAX(1,rc)):((lp-lc)/MAX(1,lc));
+                              *limit = o && lc < rc ? (rp - rc) / MAX(1, rc) : 
(lp - lc) / MAX(1, lc);
                              break;
-                        }                                    
+                        }
                        if (BATextend(bn, BATcapacity(bn)+g) == NULL)
-                             goto failed; 
+                             goto failed;
                }
                bnh = (oid*)Hloc(bn, bnf);
                bnt = (oid*)Tloc(bn, bnf);
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
@@ -199,9 +199,7 @@ int malAtomProperty(MalBlkPtr mb, InstrP
                }
                break;
        case 's':
-               if (idcmp("storage", name) || pci->argc != 1)
-                       return 0;
-               else {
+               if (idcmp("storage", name) == 0 && pci->argc == 1) {
                        BATatoms[tpe].storage = (*(long (*)(void))pci->fcn)();
                        setAtomName(pci);
                        return 1;
@@ -222,9 +220,7 @@ int malAtomProperty(MalBlkPtr mb, InstrP
                }
                break;
        case 'v':
-               if (idcmp("varsized", name) || pci->argc != 1)
-                       return 0;
-               else {
+               if (idcmp("varsized", name) == 0 && pci->argc == 1) {
                        BATatoms[tpe].varsized = (*(long (*)(void))pci->fcn)();
                        setAtomName(pci);
                        return 1;
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
@@ -994,10 +994,12 @@ showInFlow(MalBlkPtr mb, int pc, int var
        /* find last use, needed for operations with side effects */
        for (i = pc - 1; i >= 0; i--) {
                p = getInstrPtr(mb, i);
-               for (k = 0; k < p->argc; k++)
-                       if (p->argv[k] == varid)
+               for (k = 0; k < p->argc; k++) {
+                       if (p->argv[k] == varid ) {
                                mnstr_printf(f, "n%d -> n%d\n", i, pc);
-               return;
+                               return;
+                       }
+               }
        }
 }
 
diff --git a/monetdb5/mal/mal_interpreter.mx b/monetdb5/mal/mal_interpreter.mx
--- a/monetdb5/mal/mal_interpreter.mx
+++ b/monetdb5/mal/mal_interpreter.mx
@@ -2573,8 +2573,10 @@ void releaseBAT(MalBlkPtr mb, MalStkPtr 
                                mb->profiler[ppc].ticks = 0;
                                mb->profiler[ppc].clock = stk->clock;
                                /* emit the instruction upon start as well */
-                               if (@2 && malProfileMode)
+#if @2
+                               if (malProfileMode)
                                        profilerEvent(cntxt->idx, mb, stk, 
stkpc,1);
+#endif
 #ifdef HAVE_TIMES
                                times(&stk->timer);
                                mb->profiler[ppc].timer = stk->timer;
diff --git a/monetdb5/mal/mal_parser.mx b/monetdb5/mal/mal_parser.mx
--- a/monetdb5/mal/mal_parser.mx
+++ b/monetdb5/mal/mal_parser.mx
@@ -1120,12 +1120,12 @@ during the final phase reshuffle the ret
                                setPolymorphic(curInstr,type,TRUE);
                        setVarType(curBlk,varid,type);
                        @:propList(varid)@
-               } else 
-               if( @1){
+               } else {
+#if @1
                        parseError(cntxt,"Argument defined twice\n");
                        typeElm(cntxt,getVarType(curBlk,varid));
                        @:propList(varid)@
-               } else {
+#else
                        advance(cntxt,l);
                        type= typeElm(cntxt,getVarType(curBlk,varid));
                        if( type != getVarType(curBlk,varid))
@@ -1134,6 +1134,7 @@ during the final phase reshuffle the ret
                                setPolymorphic(curInstr,type,TRUE);
                        setVarType(curBlk,varid,type);
                        @:propList(varid)@
+#endif
                }
        } else if( currChar(cntxt)== ':' ){
                type= typeElm(cntxt,TYPE_any);
diff --git a/monetdb5/mal/mal_properties.c b/monetdb5/mal/mal_properties.c
--- a/monetdb5/mal/mal_properties.c
+++ b/monetdb5/mal/mal_properties.c
@@ -353,11 +353,11 @@ PropertyOperatorString( prop_op_t op )
        switch(op) {
        case op_lt: return "<";
        case op_lte: return "<=";
+       default:
        case op_eq: return "=";
        case op_gte: return ">=";
        case op_gt: return ">";
        case op_ne: return "!=";
        }
-       return "=";
 }
 
diff --git a/monetdb5/modules/kernel/aggr_be_avg.mx 
b/monetdb5/modules/kernel/aggr_be_avg.mx
--- a/monetdb5/modules/kernel/aggr_be_avg.mx
+++ b/monetdb5/modules/kernel/aggr_be_avg.mx
@@ -70,7 +70,8 @@ All Rights Reserved.
 */
 @= aggrX3_avg
        ALGODEBUG THRprintf(GDKout, 
"#aggrX3_avg(@1,@2,@3,@4,@5,@6,@7,@8,@9);\n");
-       if (@1 && range > 0) {
+#if @1
+       if (range > 0) {
                /* create tmp. sums array */
                sums = (dbl*) GDKzalloc(range*sizeof(dbl));
                if (sums == NULL) {
@@ -79,24 +80,33 @@ All Rights Reserved.
                        return GDK_FAIL;
                }
        }
-       if (@2 && BATprepareHash(bn)) {
+#endif
+#if @2
+       if (BATprepareHash(bn)) {
                GDKerror("aggrX3_avg(@1,@2,@3,@4,@5,@6,@7,@8,@9): 
BATprepareHash(bn) failed");
-               if (@1 && sums)
+#if @1
+               if (sums)
                        GDKfree(sums);
+#endif
                BBPreclaim(bn);
                return GDK_FAIL;
        }
+#endif
        cnt = (BUN*) GDKzalloc(slots*sizeof(cnt[0]));
        if (cnt == NULL) {
                GDKerror("aggrX3_avg(@1,@2,@3,@4,@5,@6,@7,@8,@9): cnt = 
GDKzalloc("OIDFMT"*"SZFMT") failed", slots, sizeof(cnt[0]));
-               if (@1 && sums)
+#if @1
+               if (sums)
                        GDKfree(sums);
+#endif
                BBPreclaim(bn);
                return GDK_FAIL;
        }
        /* scan b, adding sums, and incrementing counts */
        bhsb = b->hseqbase - 1;
-       if (!(@1 && sums))
+#if @1
+       if (!sums)
+#endif
                
BATaccessBegin(bn,USE_HEAD|USE_HHASH|USE_TAIL,BAThordered(b)&BAThordered(e)&1?MMAP_SEQUENTIAL:MMAP_WILLNEED);
        if (b_use)
                BATaccessBegin(b,b_use,MMAP_SEQUENTIAL);
@@ -133,11 +143,13 @@ All Rights Reserved.
        }
        if (b_use)
                BATaccessEnd(b,b_use,MMAP_SEQUENTIAL);
-       if (!(@1 && sums))
+#if @1
+       if (!sums)
+#endif
                
BATaccessEnd(bn,USE_HEAD|USE_HHASH|USE_TAIL,BAThordered(b)&BAThordered(e)&1?MMAP_SEQUENTIAL:MMAP_WILLNEED);
        /* postprocess by dividing sums by counts */
-       if (@1) {
-           if (sums) {
+#if @1
+       if (sums) {
                /* sums in sums-array */
                BATaccessBegin(bn,USE_HEAD|USE_TAIL,MMAP_SEQUENTIAL);
                BATloop(bn, p, q) {
@@ -151,8 +163,9 @@ All Rights Reserved.
                }
                BATaccessEnd(bn,USE_HEAD|USE_TAIL,MMAP_SEQUENTIAL);
                GDKfree(sums);
-           }
-       } else {
+       }
+#else
+       {
                /* sums in-place */
_______________________________________________
Checkin-list mailing list
Checkin-list@monetdb.org
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to