Update of /cvsroot/monetdb/MonetDB5/src/mal
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv17429
Modified Files:
mal_module.mx
Log Message:
Revive the dormant operation to produce the completion table in
tablet format. It can be used by frontends to initialize their
own completion table, e.g. by sending manual.completion("*.*)")
and captuaring the output.
Index: mal_module.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB5/src/mal/mal_module.mx,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -d -r1.60 -r1.61
--- mal_module.mx 13 Sep 2007 21:45:23 -0000 1.60
+++ mal_module.mx 14 Sep 2007 07:13:28 -0000 1.61
@@ -789,6 +789,8 @@
return 1;
return 0;
}
+
+#define MAXHELP 500
char **getHelp(Module m, str inputpat, int completion)
{
str pat, modnme, fcnnme = 0;
@@ -797,11 +799,12 @@
int len1 = 0,len2 = 0,fnd=0;
char *t, **msg, buf[BUFSIZ];
int top=0, i,j,k, sig = 0, doc = 0;
+ int maxhelp= MAXHELP;
#ifdef MAL_SCOPE_DEBUG
printf("showHelp: %s",pat);
#endif
- msg= (char **) GDKmalloc( 1000 * sizeof(str));
+ msg= (char **) GDKmalloc( MAXHELP * sizeof(str));
msg[top]=0;
if (!inputpat)
@@ -852,9 +855,9 @@
if( strncmp(modnme,m->name,len1) ==0 ||
*modnme=='*'){
msg[top++] = GDKstrdup(m->name);
msg[top] =0;
- if( top == 999) {
- GDKfree(pat);
- return msg;
+ if( top == maxhelp-1) {
+ msg= (char **)
GDKrealloc(msg,sizeof(str)* maxhelp);
+ maxhelp+= MAXHELP;
}
}
m= m->sibling;
@@ -908,10 +911,6 @@
if(fnd) continue;
msg[top++]= GDKstrdup(buf+1);
- if( top >=998) {
- GDKfree(pat);
- return msg;
- }
if(v){
*v='a';
msg[top++]= GDKstrdup(v);
@@ -940,9 +939,9 @@
msg[top++] = GDKstrdup(buf+1);
msg[top] = 0;
}
- if( top >=998) {
- GDKfree(pat);
- return msg;
+ if( top >= maxhelp-3){
+ msg= (char **)
GDKrealloc(msg,sizeof(str)* (maxhelp+MAXHELP));
+ maxhelp+= MAXHELP;
}
}
m= m->sibling;
@@ -961,8 +960,9 @@
Module m;
Symbol s;
int top = 0, i,j,k;
+ int maxhelp= MAXHELP;
- msg= (char **) GDKmalloc( 2000 * sizeof(str));
+ msg= (char **) GDKmalloc( maxhelp * sizeof(str));
msg[top]=0;
if (!pat)
@@ -1002,7 +1002,10 @@
}
msg[top++] = GDKstrdup(buf);
msg[top] = 0;
- if( top == 1999) return msg;
+ if( top == maxhelp-1){
+ msg= (char **)
GDKrealloc(msg,sizeof(str)* (maxhelp+MAXHELP));
+ maxhelp+= MAXHELP;
+ }
}
m= m->sibling;
}
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Monetdb-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-checkins