Changeset: e58fb9c1aad0 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=e58fb9c1aad0
Modified Files:
        monetdb5/mal/mal_resolve.mx
        sql/backends/monet5/datacell/actuator.c
Branch: Aug2011
Log Message:

Remove dependency on alloca


diffs (114 lines):

diff --git a/monetdb5/mal/mal_resolve.mx b/monetdb5/mal/mal_resolve.mx
--- a/monetdb5/mal/mal_resolve.mx
+++ b/monetdb5/mal/mal_resolve.mx
@@ -135,7 +135,7 @@
        int i,k, unmatched = 0, s1;
        /* int foundbutwrong=0;*/
        int polytype[MAXTYPEVAR];
-       int *returntype;
+       int *returntype= NULL;;
 @-
 Within a module find the subscope to locate the element in its list
 of symbols. A skiplist is used to speed up the search for the
@@ -341,7 +341,7 @@
 the resulting type can not be determined.
 @c
        s1 = 0;
-       returntype= (int*) alloca(p->retc * sizeof(int));
+       returntype= (int*) GDKzalloc(p->retc * sizeof(int));
        if( sig->polymorphic)
        for(k=i=0; i < p->retc; k++, i++){
                int actual = getArgType(mb,p,i);
@@ -394,7 +394,7 @@
                        showScriptException( mb, getPC(mb,p), TYPE, "Assignment 
to constant");
                        p->typechk= TYPE_UNKNOWN;
                        mb->errors++;
-                       return -3;
+                       goto wrapup;
                }
                if( !isVarFixed(mb,getArg(p,i)) && ts>=0) {
                        setVarType(mb, getArg(p,i),ts);
@@ -438,7 +438,8 @@
                }
                if(cnt==0 && s->kind!= COMMANDsymbol && s->kind!=PATTERNsymbol 
){
                        s = cloneFunction(scope, s, mb,p);
-                       if( s->def->errors) return -3;
+                       if( s->def->errors)
+                               goto wrapup;
                }
        }
 @-
@@ -450,7 +451,7 @@
        if (s->def->errors) {
                p->typechk = TYPE_UNKNOWN;
                mb->errors++;
-               return -3;
+               goto wrapup;
        }
        if (p->token == ASSIGNsymbol) {
                switch (getSignature(s)->token) {
@@ -463,7 +464,7 @@
                                                        p->modname, p->fcnname);
                                        p->typechk = TYPE_UNKNOWN;
                                        mb->errors++;
-                                       return -3;
+                                       goto wrapup;
                                }
                                break;
                        case PATTERNsymbol:
@@ -484,7 +485,7 @@
                                        showScriptException(mb, getPC(mb, p), 
MAL,
                                                        "MALresolve: unexpected 
token type");
                                mb->errors++;
-                               return -3;
+                               goto wrapup;
                        }
                }
                p->blk = s->def;
@@ -512,6 +513,8 @@
                mnstr_printf(GDKout,"Finished matching\n");
        }
 #endif
+       if ( returntype)
+               GDKfree(returntype);
        return s1;
        } /* while */
 @-
@@ -519,12 +522,15 @@
 that we found an instruction with the proper arguments, but that clashes
 with one of the target variables.
 @c
+wrapup:
        /* foundbutwrong has not been changed, commented out code above
        if( foundbutwrong && !silent){
                showScriptException(mb, getPC(mb, p), TYPE,
                        "type conflict in assignment");
        }
        */
+       if ( returntype)
+               GDKfree(returntype);
        return -3;
 }
 
@@ -810,6 +816,7 @@
                        @:bindFunction@
                }
        }
+wrapup:
        return 0;
 }
 @-
diff --git a/sql/backends/monet5/datacell/actuator.c 
b/sql/backends/monet5/datacell/actuator.c
--- a/sql/backends/monet5/datacell/actuator.c
+++ b/sql/backends/monet5/datacell/actuator.c
@@ -102,8 +102,8 @@
 
 The code is relatively straightforward to extend to create your favoured dummy 
sensor.
 */
-void
-usage()
+static void
+usage(void)
 {
        mnstr_printf(ACout, "The actuator tool can be used to catch an event 
sequence \n");
        mnstr_printf(ACout, "from the emitter port. Data is in ascii .\n");
_______________________________________________
Checkin-list mailing list
Checkin-list@monetdb.org
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to