Update of /cvsroot/monetdb/MonetDB5/src/optimizer
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv21446/src/optimizer

Modified Files:
        opt_remap.mx 
Log Message:
need to keep the original value of the variable when doing a OPTremapSwitch
(else the mapped string is freed)


Index: opt_remap.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB5/src/optimizer/opt_remap.mx,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- opt_remap.mx        1 Jun 2007 06:48:29 -0000       1.7
+++ opt_remap.mx        1 Jun 2007 09:22:41 -0000       1.8
@@ -148,15 +148,19 @@
        for(i=0;OperatorMap[i].src;i++)
        if( strcmp(fcn,OperatorMap[i].src)==0){
                /* found a candidate for a switch */
-               getConstant(mb, getArg(pci, 2)).val.sval= 
putName(OperatorMap[i].dst,OperatorMap[i].len);
-               getConstant(mb, getArg(pci, 2)).len= strlen(fcn);
-               r= getArg(pci,3); getArg(pci,3)=getArg(pci,4);getArg(pci,4)=r;
-               r=OPTremapDirect(mb, stk, pci, scope);
-               if( r) return 1;
-               /* restore the state */
+               getConstant(mb, getArg(pci, 2)).val.sval = 
putName(OperatorMap[i].dst,OperatorMap[i].len);
+               getConstant(mb, getArg(pci, 2)).len = OperatorMap[i].len;
                r= getArg(pci,3); getArg(pci,3)=getArg(pci,4);getArg(pci,4)=r;
+               r= OPTremapDirect(mb, stk, pci, scope);
+
+               /* always restore the allocated function name */
                getConstant(mb, getArg(pci, 2)).val.sval= fcn;
                getConstant(mb, getArg(pci, 2)).len= strlen(fcn);
+
+               if (r) return 1;
+
+               /* restore the arguments */
+               r= getArg(pci,3); getArg(pci,3)=getArg(pci,4);getArg(pci,4)=r;
        }
        return 0;
 }
@@ -182,7 +186,7 @@
                                OPTremapSwitched(mb, stk, p, scope)){
                                freeInstruction(p); 
                                doit++;
-                       } else{
+                       } else {
                                pushInstruction(mb, p);
                        }
                } else


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Monetdb-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-checkins

Reply via email to