Changeset: 976c2bee6422 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=976c2bee6422 Modified Files: sql/backends/monet5/vaults/mseed.c Branch: sciql Log Message:
Merge with default branch. diffs (truncated from 1427 to 300 lines): diff --git a/clients/odbc/driver/SQLBrowseConnect.c b/clients/odbc/driver/SQLBrowseConnect.c --- a/clients/odbc/driver/SQLBrowseConnect.c +++ b/clients/odbc/driver/SQLBrowseConnect.c @@ -36,7 +36,6 @@ * **********************************************************************/ -#include <monetdb_config.h> #include "ODBCGlobal.h" #include "ODBCDbc.h" #include "ODBCUtil.h" diff --git a/clients/odbc/driver/SQLConnect.c b/clients/odbc/driver/SQLConnect.c --- a/clients/odbc/driver/SQLConnect.c +++ b/clients/odbc/driver/SQLConnect.c @@ -36,11 +36,10 @@ * **********************************************************************/ -#include <monetdb_config.h> -#include <monet_options.h> #include "ODBCGlobal.h" #include "ODBCDbc.h" #include "ODBCUtil.h" +#include <monet_options.h> #ifdef HAVE_STRINGS_H #include <strings.h> #endif diff --git a/clients/odbc/setup/drvcfg.c b/clients/odbc/setup/drvcfg.c --- a/clients/odbc/setup/drvcfg.c +++ b/clients/odbc/setup/drvcfg.c @@ -28,6 +28,9 @@ * ----------------------------------------------- * Peter Harvey - [email protected] **************************************************/ + +#include "monetdb_config.h" + #include <drvcfg.h> #include <string.h> /* for memset(), memcpy(), strncpy() */ diff --git a/clients/odbc/setup/drvcfg.h b/clients/odbc/setup/drvcfg.h --- a/clients/odbc/setup/drvcfg.h +++ b/clients/odbc/setup/drvcfg.h @@ -31,8 +31,6 @@ #ifndef _ODBCINST_H #define _ODBCINST_H -#include "monetdb_config.h" - #include <unistd.h> #ifdef HAVE_PWD_H #include <pwd.h> diff --git a/monetdb5/mal/mal_authorize.c b/monetdb5/mal/mal_authorize.c --- a/monetdb5/mal/mal_authorize.c +++ b/monetdb5/mal/mal_authorize.c @@ -1021,55 +1021,56 @@ */ static str AUTHhashPassword(str *ret, str *algo, str *password, str *challenge) { - str tmp; + str tmp = MAL_SUCCEED; int len = (int) (strlen(*password) + strlen(*challenge)); - str key = alloca(sizeof(char) * (len + 1)); + str key = GDKmalloc(sizeof(char) * (len + 1)); snprintf(key, len + 1, "%s%s", *password, *challenge); #ifdef HAVE_RIPEMD160 if (strcmp(*algo, "RIPEMD160") == 0) { - rethrow("hashPassword", tmp, AUTHRIPEMD160Sum(ret, &key, &len)); + tmp = AUTHRIPEMD160Sum(ret, &key, &len); } else #endif #ifdef HAVE_SHA512 if (strcmp(*algo, "SHA512") == 0) { int bits = 512; - rethrow("hashPassword", tmp, AUTHSHA2Sum(ret, &key, &len, &bits)); + tmp = AUTHSHA2Sum(ret, &key, &len, &bits); } else #endif #ifdef HAVE_SHA384 if (strcmp(*algo, "SHA384") == 0) { int bits = 384; - rethrow("hashPassword", tmp, AUTHSHA2Sum(ret, &key, &len, &bits)); + tmp = AUTHSHA2Sum(ret, &key, &len, &bits); } else #endif #ifdef HAVE_SHA256 if (strcmp(*algo, "SHA256") == 0) { int bits = 256; - rethrow("hashPassword", tmp, AUTHSHA2Sum(ret, &key, &len, &bits)); + tmp = AUTHSHA2Sum(ret, &key, &len, &bits); } else #endif #ifdef HAVE_SHA224 if (strcmp(*algo, "SHA224") == 0) { int bits = 224; - rethrow("hashPassword", tmp, AUTHSHA2Sum(ret, &key, &len, &bits)); + tmp = AUTHSHA2Sum(ret, &key, &len, &bits); } else #endif #ifdef HAVE_SHA1 if (strcmp(*algo, "SHA1") == 0) { - rethrow("hashPassword", tmp, AUTHSHA1Sum(ret, &key, &len)); + tmp = AUTHSHA1Sum(ret, &key, &len); } else #endif #ifdef HAVE_MS5 if (strcmp(*algo, "MD5") == 0) { - rethrow("hashPassword", tmp, AUTHMD5Sum(ret, &key, &len)); + tmp = AUTHMD5Sum(ret, &key, &len); } else #endif { throw(MAL, "hashPassword", "unsupported hash type: '%s'", *algo); } - return(MAL_SUCCEED); + GDKfree(key); + return(tmp); } /** diff --git a/monetdb5/mal/mal_recycle.c b/monetdb5/mal/mal_recycle.c --- a/monetdb5/mal/mal_recycle.c +++ b/monetdb5/mal/mal_recycle.c @@ -420,8 +420,7 @@ (void) cntxt; - wben = (dbl *)alloca(sizeof(dbl)*ltop); - memset(wben,0, sizeof(dbl)*ltop); + wben = (dbl *)GDKzalloc(sizeof(dbl)*ltop); for (l = 0; l < ltop; l++){ sz = recycleBlk->profiler[lvs[l]].wbytes; switch(rcachePolicy){ @@ -434,8 +433,10 @@ wben[l] = sz? ben / sz : -1; totmem += sz; } - if (totmem <= wr) /* all leaves need to be dropped */ + if (totmem <= wr) { /* all leaves need to be dropped */ + GDKfree(wben); return ltop; + } /* reorder instructions on increasing weighted credit */ /* knapsack: find a set with biggest wben fitting in totmem-wr. @@ -501,6 +502,7 @@ mnstr_printf(cntxt->fdout,"Don't drop critical item : instruction %d, credit %f\n" ,tmpl,ci_ben); #endif } + GDKfree(wben); return newtop; } 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 @@ -130,11 +130,13 @@ } #endif -static malType findFunctionType(Module scope, MalBlkPtr mb, InstrPtr p,int silent){ +static malType +findFunctionType(Module scope, MalBlkPtr mb, InstrPtr p, int silent) +{ Module m; Symbol s; InstrPtr sig; - int i,k, unmatched = 0, s1; + int i, k, unmatched = 0, s1; /* int foundbutwrong=0;*/ int polytype[MAXTYPEVAR]; int *returntype; @@ -155,164 +157,164 @@ * it will be looked up multiple types to resolve the instruction.[todo] * Simplify polytype using a map into the concrete argument table. */ - m= scope; - s= m->subscope[(int)(getSubScope(getFunctionId(p)))]; - if( s == 0) return -1; - while(s != NULL){ /* single scope element check */ - if( getFunctionId(p) != s->name ){ - s= s->skip; continue; - } - /* - * @- - * Perform a strong type-check on the actual arguments. If it turns - * out to be a polymorphic MAL function, we have to clone it. - * Provided the actual/formal parameters are compliant throughout - * the function call. - * - * Also look out for variable argument lists. This means that we - * have to keep two iterators, one for the caller (i) and one for - * the callee (k). Since a variable argument only occurs as the last one, - * we simple avoid an increment when running out of formal arguments. - * - * A call of the form (X1,..., Xi) := f(Y1,....,Yn) can be matched against - * the function signature (B1,...,Bk):= f(A1,...,Am) where i==k , n<=m - * and type(Ai)=type(Yi). Furthermore, the variables Xi obtain their type - * from Bi (or type(Bi)==type(Xi)). - */ - sig = getSignature(s); - unmatched = 0; + m = scope; + s = m->subscope[(int)(getSubScope(getFunctionId(p)))]; + if (s == 0) return -1; + while (s != NULL) { /* single scope element check */ + if (getFunctionId(p) != s->name) { + s = s->skip; continue; + } + /* + * @- + * Perform a strong type-check on the actual arguments. If it turns + * out to be a polymorphic MAL function, we have to clone it. + * Provided the actual/formal parameters are compliant throughout + * the function call. + * + * Also look out for variable argument lists. This means that we + * have to keep two iterators, one for the caller (i) and one for + * the callee (k). Since a variable argument only occurs as the last one, + * we simple avoid an increment when running out of formal arguments. + * + * A call of the form (X1,..., Xi) := f(Y1,....,Yn) can be matched against + * the function signature (B1,...,Bk):= f(A1,...,Am) where i==k , n<=m + * and type(Ai)=type(Yi). Furthermore, the variables Xi obtain their type + * from Bi (or type(Bi)==type(Xi)). + */ + sig = getSignature(s); + unmatched = 0; #ifdef DEBUG_MAL_RESOLVE - if(tracefcn) { - mnstr_printf(GDKout,"-->resolving\n"); - printInstruction(GDKout,mb,0,p,LIST_MAL_ALL); - mnstr_printf(GDKout,"++> test against signature\n"); - printInstruction(GDKout,s->def,0,getSignature(s),LIST_MAL_ALL); - mnstr_printf(GDKout," %s \n", sig->polymorphic?"polymorphic":""); - } + if (tracefcn) { + mnstr_printf(GDKout, "-->resolving\n"); + printInstruction(GDKout, mb, 0, p, LIST_MAL_ALL); + mnstr_printf(GDKout, "++> test against signature\n"); + printInstruction(GDKout, s->def, 0, getSignature(s), LIST_MAL_ALL); + mnstr_printf(GDKout, " %s \n", sig->polymorphic ? "polymorphic" : ""); + } #endif - /* - * @- - * The simple case could be taken care of separately to speedup processing - * However, it turned out not to make a big difference. - * The first time we encounter a polymorphic argument in the - * signature. - * Subsequently, the polymorphic arguments update this table - * and check for any type mismatches that might occur. - * There are at most 2 type variables involved per argument - * due to the limited type nesting permitted. - * Note, each function returns at least one value. - */ - if( sig->polymorphic ){ - int limit = sig->polymorphic; - if( ! (sig->argc== p->argc || - (sig->argc<p->argc && sig->varargs & (VARARGS | VARRETS) )) - ){ - s= s->peer; continue; - } - if( sig->retc != p->retc && !(sig->varargs & VARRETS)) { - s= s->peer; - continue; - } -/* if(polyVector[0]==0) polyInit(); - memcpy(polytype,polyVector, 2*sig->argc*sizeof(int)); */ - - for(k=0; k< limit; k++) polytype[k] = TYPE_any; - /* - * @- - * Most polymorphic functions don;t have a variable argument - * list. So we save some instructions factoring this caise out. - * Be careful, the variable number of return arguments should - * be considered as well. - */ - i= p->retc; - /* first handle the variable argument list */ - for(k=sig->retc; i<p->argc; k++, i++){ - int actual = getArgType(mb,p,i); - int formal = getArgType(s->def,sig,k); - if (k == sig->argc-1 && sig->varargs & VARARGS) - k--; /* * @- - * Take care of variable argument lists. - * They are allowed as the last in the signature only. - * Furthermore, for patterns if the formal type is 'any' then all remaining arguments - * are acceptable and detailed type analysis becomes part of the pattern - * implementation. - * In all other cases the type should apply to all remaining arguments. + * The simple case could be taken care of separately to speedup processing + * However, it turned out not to make a big difference. + * The first time we encounter a polymorphic argument in the + * signature. _______________________________________________ Checkin-list mailing list [email protected] http://mail.monetdb.org/mailman/listinfo/checkin-list
