From 88483db112b15569aad4898d30a8ab7ea4deb96b Mon Sep 17 00:00:00 2001 From: Denis Vlasenko Date: Mon, 30 Jul 2007 17:02:06 +0000 Subject: make regex_old.c, ruserpass.c use __uc_malloc, replace "buf = malloc(BUFSIZ); if (!buf) abort();" by __uc_malloc elsewhere. With last 7 patches together uclibc has 3k of static data total with fairly big .config and with 2k being used for 2 x BUFSIZ stdio buffer: text data bss dec hex filename 114 132 2048 2294 8f6 _stdio.o (ex lib/libc.a) total data 593 total bss 3062 --- libc/misc/regex/regex_old.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'libc/misc/regex') diff --git a/libc/misc/regex/regex_old.c b/libc/misc/regex/regex_old.c index cf5843ec5..997ee6f8b 100644 --- a/libc/misc/regex/regex_old.c +++ b/libc/misc/regex/regex_old.c @@ -35,6 +35,7 @@ #include #include #include +#include #include libc_hidden_proto(memset) @@ -306,7 +307,7 @@ extern char *re_syntax_table; # else /* not SYNTAX_TABLE */ -static char re_syntax_table[CHAR_SET_SIZE]; +static char *re_syntax_table; /* [CHAR_SET_SIZE] */ static void init_syntax_once PARAMS ((void)); @@ -314,11 +315,13 @@ static void init_syntax_once () { register int c; - static int done = 0; + static char done; if (done) return; - bzero (re_syntax_table, sizeof re_syntax_table); + + re_syntax_table = __uc_malloc(CHAR_SET_SIZE); + bzero (re_syntax_table, CHAR_SET_SIZE); for (c = 0; c < CHAR_SET_SIZE; ++c) if (ISALNUM (c)) -- cgit v1.2.3