lkml.org 
[lkml]   [2002]   [May]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] kbuild: Remove 2048 symbol limit in tkparse
tkparse limit the number of symbols to 2048.
This patch makes the array dynamic avoiding this problem in the future.
The problem showed up in one of the powerpc tree's.

Credit for this patch goes to Keith Owens, I just extracted it from kbuild-2.5.

Sam
--- tkparse.h.orig Fri May 31 22:03:24 2002
+++ tkparse.h Fri May 31 21:42:03 2002
@@ -115,7 +115,7 @@
char global_written;
};

-extern struct variable vartable[];
+extern struct variable *vartable;
extern int max_varnum;

/*
--- tkparse.c.orig Fri May 31 22:03:14 2002
+++ tkparse.c Fri May 31 21:42:03 2002
@@ -74,12 +74,12 @@


/*
- * Find index of a specyfic variable in the symbol table.
+ * Find index of a specific variable in the symbol table.
* Create a new entry if it does not exist yet.
*/
-#define VARTABLE_SIZE 4096
-struct variable vartable[VARTABLE_SIZE];
+struct variable *vartable;
int max_varnum = 0;
+static int vartable_size = 0;

int get_varnum( char * name )
{
@@ -88,8 +88,13 @@
for ( i = 1; i <= max_varnum; i++ )
if ( strcmp( vartable[i].name, name ) == 0 )
return i;
- if (max_varnum > VARTABLE_SIZE-1)
- syntax_error( "Too many variables defined." );
+ while (max_varnum+1 >= vartable_size) {
+ vartable = realloc(vartable, (vartable_size += 1000)*sizeof(*vartable));
+ if (!vartable) {
+ fprintf(stderr, "tkparse realloc vartable failed\n");
+ exit(1);
+ }
+ }
vartable[++max_varnum].name = malloc( strlen( name )+1 );
strcpy( vartable[max_varnum].name, name );
return max_varnum;
@@ -818,5 +823,6 @@
do_source ( "-" );
fix_conditionals ( config_list );
dump_tk_script ( config_list );
+ free(vartable);
return 0;
}
\
 
 \ /
  Last update: 2005-03-22 13:22    [W:0.059 / U:0.296 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site