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

Modified Files:
        opt_replicator.mx 
Log Message:
Compress the code...
THe function REPselec_wrap is now called by REPselect and REPuselect. One flag 
is used to distinguish them.
In this case we avoid 2 functions implementation where the only difference is 
an argument in a function call.




Index: opt_replicator.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB5/src/optimizer/opt_replicator.mx,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- opt_replicator.mx   12 Feb 2008 12:07:03 -0000      1.12
+++ opt_replicator.mx   12 Feb 2008 13:11:05 -0000      1.13
@@ -442,8 +442,8 @@
        return MAL_SUCCEED;
 }
 
-str
-REPselect(MalBlkPtr mb, MalStkPtr stk, InstrPtr pci)
+static str
+REPselect_wrap(MalBlkPtr mb, MalStkPtr stk, InstrPtr pci, int uselect)
 {
        int *ret, *bid, tpe;
        ptr low, hgh;
@@ -466,7 +466,7 @@
        }
        
        if ((b = BATdescriptor(*bid)) == NULL) {
-                throw(MAL, "REPselect", "Cannot access descriptor");
+                throw(MAL, uselect ? "REPuselect" : "REPselect", "Cannot 
access descriptor");
         }
        
        tpe= ATOMstorage(b->T->type);
@@ -481,54 +481,22 @@
        tname = *(str *) getArgReference(stk, pci,argcnt-2);
        cname = *(str *) getArgReference(stk, pci,argcnt-1);
        
-       REPselectImpl(ret, b, low, hgh, *li, *hi, sname,tname,cname, TRUE);
+       REPselectImpl(ret, b, low, hgh, *li, *hi, sname,tname,cname, uselect ? 
FALSE : TRUE);
        BBPreleaseref(b->batCacheid);
        return MAL_SUCCEED;
 }
 
+
 str
-REPuselect(MalBlkPtr mb, MalStkPtr stk, InstrPtr pci)
+REPselect(MalBlkPtr mb, MalStkPtr stk, InstrPtr pci)
 {
-       int *ret, *bid, tpe;
-       ptr low, hgh;
-       bit t=TRUE,*li=&t,*hi=&t;
-       BAT *b;
-       sht argcnt = pci->argc;
-       str sname, tname, cname;
-
-       (void) mb;
-       ret= (int*) getArgReference(stk, pci,0);
-       bid= (int*) getArgReference(stk, pci,1);
-       low= (ptr) getArgReference(stk, pci,2);
-       if( argcnt >= 7)
-                hgh = (ptr) getArgReference(stk,pci,3);
-        else hgh = low;
-
-       if( argcnt==9){
-               li= (bit*) getArgReference(stk, pci,4);
-               hi= (bit*) getArgReference(stk, pci,5);
-       }
-       
-       if ((b = BATdescriptor(*bid)) == NULL) {
-                throw(MAL, "REPselect", "Cannot access descriptor");
-        }
-       
-       tpe= ATOMstorage(b->T->type);
-        if( tpe == TYPE_str || tpe > TYPE_str ){
-                if(low== 0 || *(str*)low==0) low = (str)str_nil;
-                        else low = *(str *)low;
-                if(hgh== 0 || *(str*)hgh==0) hgh = (str)str_nil;
-                        else hgh = *(str *)hgh;
-        }
-
-       sname = *(str *) getArgReference(stk, pci,argcnt-3);
-       tname = *(str *) getArgReference(stk, pci,argcnt-2);
-       cname = *(str *) getArgReference(stk, pci,argcnt-1);
-       
-       REPselectImpl(ret, b, low, hgh, *li, *hi, sname,tname,cname, FALSE);
-       BBPreleaseref(b->batCacheid);
-       return MAL_SUCCEED;
+       return REPselect_wrap(mb, stk, pci, 0);
 }
 
+str
+REPuselect(MalBlkPtr mb, MalStkPtr stk, InstrPtr pci)
+{
+       return REPselect_wrap(mb, stk, pci, 1);
+}
 
 @}


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Monetdb-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-checkins

Reply via email to