Changeset: 516be8848194 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=516be8848194 Modified Files: monetdb5/modules/mal/manual.c Branch: default Log Message:
No need to store the whole table on the stack before adding to BATs. diffs (85 lines): diff --git a/monetdb5/modules/mal/manual.c b/monetdb5/modules/mal/manual.c --- a/monetdb5/modules/mal/manual.c +++ b/monetdb5/modules/mal/manual.c @@ -26,13 +26,9 @@ MANUALcreateOverview(Client cntxt, MalBl Module s; Module* moduleList; int length; - int j, k, ftop, top = 0; + int j, k, top = 0; Symbol t; - Module list[256]; - MalBlkPtr blks[25000]; - str mtab[25000]; - str ftab[25000]; - str hlp[25000]; + Module list[256]; char buf[BUFSIZ], *tt; mod = COLnew(0, TYPE_str, 0, TRANSIENT); @@ -58,48 +54,28 @@ MANUALcreateOverview(Client cntxt, MalBl } freeModuleList(moduleList); - for(k = 0; k < top; k++){ + for (k = 0; k < top; k++) { s = list[k]; - ftop = 0; - if( s->space) - for(j=0;j<MAXSCOPE;j++) - if(s->space[j]){ - for(t= s->space[j];t!=NULL;t=t->peer) { - mtab[ftop]= t->def->stmt[0]->modname; - ftab[ftop]= t->def->stmt[0]->fcnname; - hlp[ftop]= t->def->help; - blks[ftop]= t->def; - ftop++; - if( ftop == 25000) { - BBPreclaim(mod); - BBPreclaim(fcn); - BBPreclaim(sig); - BBPreclaim(adr); - BBPreclaim(com); - throw(MAL,"manual.functions","Out of space"); + if (s->space) { + for (j = 0; j < MAXSCOPE; j++) { + if (s->space[j]) { + for (t = s->space[j]; t != NULL; t = t->peer) { + (void) fcnDefinition(t->def, getInstrPtr(t->def, 0), buf, TRUE, buf, sizeof(buf)); + tt = strstr(buf, "address "); + if (tt) { + *tt = 0; + tt += 8; + } + if (BUNappend(mod, t->def->stmt[0]->modname, FALSE) != GDK_SUCCEED || + BUNappend(fcn, t->def->stmt[0]->fcnname, FALSE) != GDK_SUCCEED || + BUNappend(com, t->def->help ? t->def->help : "", TRUE) != GDK_SUCCEED || + BUNappend(sig,buf,TRUE) != GDK_SUCCEED || + BUNappend(adr, tt ? tt : "", TRUE) != GDK_SUCCEED) { + goto bailout; } } } - - for(j=0; j < ftop; j++){ - if (BUNappend(mod,mtab[j],TRUE) != GDK_SUCCEED) - goto bailout; - if (BUNappend(fcn,ftab[j],TRUE) != GDK_SUCCEED) - goto bailout; - buf[0]=0; - if (BUNappend(com, hlp[j] ? hlp[j]:buf, TRUE) != GDK_SUCCEED) - goto bailout; - fcnDefinition(blks[j], getInstrPtr(blks[j],0), buf, TRUE, buf, BUFSIZ); - tt = strstr(buf,"address "); - if( tt){ - *tt = 0; - tt += 8; } - if (BUNappend(sig,buf,TRUE) != GDK_SUCCEED) - goto bailout; - buf[0]=0; - if (BUNappend(adr,tt?tt:buf,TRUE) != GDK_SUCCEED) - goto bailout; } } _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list