Commit 891563ca authored by Kai Germaschewski's avatar Kai Germaschewski

kbuild: Remove 2048 symbol limit from make xconfig

This patch was extracted from Keith Owens' kbuild-2.5 by
patch@luckynet.dynu.com
parent 04fdcac1
...@@ -74,12 +74,12 @@ static void syntax_error( const char * msg ) ...@@ -74,12 +74,12 @@ static void syntax_error( const char * msg )
/* /*
* 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. * Create a new entry if it does not exist yet.
*/ */
#define VARTABLE_SIZE 4096 struct variable *vartable;
struct variable vartable[VARTABLE_SIZE];
int max_varnum = 0; int max_varnum = 0;
static int vartable_size = 0;
int get_varnum( char * name ) int get_varnum( char * name )
{ {
...@@ -88,8 +88,13 @@ int get_varnum( char * name ) ...@@ -88,8 +88,13 @@ int get_varnum( char * name )
for ( i = 1; i <= max_varnum; i++ ) for ( i = 1; i <= max_varnum; i++ )
if ( strcmp( vartable[i].name, name ) == 0 ) if ( strcmp( vartable[i].name, name ) == 0 )
return i; return i;
if (max_varnum > VARTABLE_SIZE-1) while (max_varnum+1 >= vartable_size) {
syntax_error( "Too many variables defined." ); 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 ); vartable[++max_varnum].name = malloc( strlen( name )+1 );
strcpy( vartable[max_varnum].name, name ); strcpy( vartable[max_varnum].name, name );
return max_varnum; return max_varnum;
...@@ -818,5 +823,6 @@ int main( int argc, const char * argv [] ) ...@@ -818,5 +823,6 @@ int main( int argc, const char * argv [] )
do_source ( "-" ); do_source ( "-" );
fix_conditionals ( config_list ); fix_conditionals ( config_list );
dump_tk_script ( config_list ); dump_tk_script ( config_list );
free(vartable);
return 0; return 0;
} }
...@@ -115,7 +115,7 @@ struct variable ...@@ -115,7 +115,7 @@ struct variable
char global_written; char global_written;
}; };
extern struct variable vartable[]; extern struct variable *vartable;
extern int max_varnum; extern int max_varnum;
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment