Changeset: 2c9d965a279a for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=2c9d965a279a
Modified Files:
        MonetDB5/src/optimizer/Tests/All
Branch: default
Log Message:

Merge with Oct2010


diffs (75 lines):

diff -r c0be18d34080 -r 2c9d965a279a MonetDB5/src/optimizer/opt_datacyclotron.mx
--- a/MonetDB5/src/optimizer/opt_datacyclotron.mx       Mon Oct 11 14:41:30 
2010 +0200
+++ b/MonetDB5/src/optimizer/opt_datacyclotron.mx       Mon Oct 11 16:00:37 
2010 +0200
@@ -239,31 +239,34 @@
 static int
 OPTdatacyclotronImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr stk, 
InstrPtr p)
 {
-       int i, actions=0, k = 0, z= 0, j = 0, num_regs = DCYREGS;
+       int i=0, actions=0, k=0, z=0, j=0, num_regs=DCYREGS, *tpes=NULL;
        DCYcatalog **regs, *reg = NULL;
        VarRecord low,hgh,max_hgh;
        InstrPtr *old, new, matq;
        int limit;
        int (*newArg)[1000];
-       char *used= (char*) GDKzalloc(num_regs * sizeof(char));
+       char *used = NULL;
+       (void) stk;
+       (void) cntxt;
+
+       if (!catalog)
+               return actions;
 
 #ifdef BIND_DATACYCLOTRON_OPT
-       int *tpes= (int*) GDKmalloc(num_regs * sizeof(int));
+       tpes= (int*) GDKmalloc(num_regs * sizeof(int));
+       if ( tpes == NULL )
+               goto out;
 #endif
+       used = (char*) GDKzalloc(num_regs * sizeof(char));
+       newArg = GDKmalloc(sizeof(*newArg) * num_regs);
+       regs = (DCYcatalog **) GDKmalloc(sizeof(*regs) * num_regs);
+       if ( (used == NULL) || (newArg == NULL) || (regs == NULL) )
+               goto out;
 
        OPTDEBUGdatacyclotron {
                mnstr_printf(cntxt->fdout,"ENTERING DATA CYCLOTRON \n");
                printFunction(cntxt->fdout,mb,0,LIST_MAL_ALL);
        }
-
-       newArg = GDKmalloc(sizeof(*newArg) * num_regs);
-
-       if ( (used == NULL) && (newArg == NULL))
-               return 0;
-       (void) stk;
-       (void) cntxt;
-
-       regs = (DCYcatalog **) GDKmalloc(sizeof(*regs) * num_regs);
        limit= mb->stop;
        old = mb->stmt;
        newMalBlkStmt(mb, mb->ssize);
@@ -425,13 +428,17 @@
                chkProgram(cntxt->nspace,mb);
                printFunction(cntxt->fdout,mb,0,LIST_MAL_ALL);
        }
-#ifdef BIND_DATACYCLOTRON_OPT
-       GDKfree(tpes);
-#endif
-       GDKfree(used);
-       GDKfree(newArg);
-       GDKfree(regs);
-       GDKfree(old);
+out:
+       if (tpes)
+               GDKfree(tpes);
+       if (used)
+               GDKfree(used);
+       if (newArg)
+               GDKfree(newArg);
+       if (regs) 
+               GDKfree(regs);
+       if (old)
+               GDKfree(old);
 
        return actions;
 }
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to