From: Sam Ravnborg <sam@ravnborg.org>
To: torvalds@transmeta.com
Cc: linux-kernel@vger.kernel.org, kbuild-devel@lists.sourceforge.net
Subject: [PATCH] kbuild: Remove 2048 symbol limit in tkparse
Date: Fri, 31 May 2002 22:41:51 +0200 [thread overview]
Message-ID: <20020531224151.A13857@mars.ravnborg.org> (raw)
[-- 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;
}
next reply other threads:[~2002-05-31 20:40 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-05-31 20:41 Sam Ravnborg [this message]
2002-06-01 1:46 ` Kai Germaschewski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20020531224151.A13857@mars.ravnborg.org \
--to=sam@ravnborg.org \
--cc=kbuild-devel@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@transmeta.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®