mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] kbuild: Remove 2048 symbol limit in tkparse
@ 2002-05-31 20:41 Sam Ravnborg
  2002-06-01  1:46 ` Kai Germaschewski
  0 siblings, 1 reply; 2+ messages in thread
From: Sam Ravnborg @ 2002-05-31 20:41 UTC (permalink / raw)
  To: torvalds; +Cc: linux-kernel, kbuild-devel

[-- Attachment #1: Type: text/plain, Size: 256 bytes --]

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

[-- Attachment #2: no2048.diff --]
[-- Type: text/plain, Size: 1452 bytes --]

--- 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;
 }

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] kbuild: Remove 2048 symbol limit in tkparse
  2002-05-31 20:41 [PATCH] kbuild: Remove 2048 symbol limit in tkparse Sam Ravnborg
@ 2002-06-01  1:46 ` Kai Germaschewski
  0 siblings, 0 replies; 2+ messages in thread
From: Kai Germaschewski @ 2002-06-01  1:46 UTC (permalink / raw)
  To: Sam Ravnborg; +Cc: linux-kernel, kbuild-devel

On Fri, 31 May 2002, Sam Ravnborg wrote:

> 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.

Thanks, I'll look at this (and the other patches) and submit it to Linus
(assuming I don't find anything wrong with it), if he didn't already merge
it.

--Kai



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-06-01  1:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-05-31 20:41 [PATCH] kbuild: Remove 2048 symbol limit in tkparse Sam Ravnborg
2002-06-01  1:46 ` Kai Germaschewski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®