svn commit: trunk/uClibc/libc: inet inet/rpc misc/mntent misc/regex mis etc...
vda at uclibc.org
vda at uclibc.org
Mon Jul 30 17:02:07 UTC 2007
Author: vda
Date: 2007-07-30 10:02:06 -0700 (Mon, 30 Jul 2007)
New Revision: 19347
Log:
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
Modified:
trunk/uClibc/libc/inet/getnetent.c
trunk/uClibc/libc/inet/getproto.c
trunk/uClibc/libc/inet/getservice.c
trunk/uClibc/libc/inet/rpc/ruserpass.c
trunk/uClibc/libc/misc/mntent/mntent.c
trunk/uClibc/libc/misc/regex/regex_old.c
trunk/uClibc/libc/misc/ttyent/getttyent.c
Changeset:
Modified: trunk/uClibc/libc/inet/getnetent.c
===================================================================
--- trunk/uClibc/libc/inet/getnetent.c 2007-07-30 16:55:05 UTC (rev 19346)
+++ trunk/uClibc/libc/inet/getnetent.c 2007-07-30 17:02:06 UTC (rev 19347)
@@ -111,9 +111,7 @@
again:
if (!line) {
- line = malloc(BUFSIZ + 1);
- if (!line)
- abort();
+ line = __uc_malloc(BUFSIZ + 1);
}
p = fgets(line, BUFSIZ, netf);
Modified: trunk/uClibc/libc/inet/getproto.c
===================================================================
--- trunk/uClibc/libc/inet/getproto.c 2007-07-30 16:55:05 UTC (rev 19346)
+++ trunk/uClibc/libc/inet/getproto.c 2007-07-30 17:02:06 UTC (rev 19347)
@@ -59,6 +59,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <malloc.h>
#include <errno.h>
libc_hidden_proto(fopen)
@@ -86,9 +87,7 @@
static void __initbuf(void)
{
if (!static_aliases) {
- static_aliases = malloc(SBUFSIZE);
- if (!static_aliases)
- abort();
+ static_aliases = __uc_malloc(SBUFSIZE);
}
}
Modified: trunk/uClibc/libc/inet/getservice.c
===================================================================
--- trunk/uClibc/libc/inet/getservice.c 2007-07-30 16:55:05 UTC (rev 19346)
+++ trunk/uClibc/libc/inet/getservice.c 2007-07-30 17:02:06 UTC (rev 19347)
@@ -59,6 +59,7 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
+#include <malloc.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <errno.h>
@@ -89,9 +90,7 @@
static void __initbuf(void)
{
if (!servbuf) {
- servbuf = malloc(SBUFSIZE);
- if (!servbuf)
- abort();
+ servbuf = __uc_malloc(SBUFSIZE);
}
}
Modified: trunk/uClibc/libc/inet/rpc/ruserpass.c
===================================================================
--- trunk/uClibc/libc/inet/rpc/ruserpass.c 2007-07-30 16:55:05 UTC (rev 19346)
+++ trunk/uClibc/libc/inet/rpc/ruserpass.c 2007-07-30 17:02:06 UTC (rev 19347)
@@ -40,6 +40,7 @@
#include <stdio_ext.h>
#include <stdlib.h>
#include <string.h>
+#include <malloc.h>
#include <strings.h>
#include <unistd.h>
@@ -79,7 +80,7 @@
#define ID 10
#define MACHINE 11
-static char tokval[100];
+static char *tokval; /* [100] */
static const char tokstr[] =
{
@@ -152,6 +153,9 @@
if (mydomain==NULL) {
mydomain=myname + strlen(myname);
}
+
+ if (!tokval)
+ tokval = __uc_malloc(100);
next:
while ((t = token())) switch(t) {
Modified: trunk/uClibc/libc/misc/mntent/mntent.c
===================================================================
--- trunk/uClibc/libc/misc/mntent/mntent.c 2007-07-30 16:55:05 UTC (rev 19346)
+++ trunk/uClibc/libc/misc/mntent/mntent.c 2007-07-30 17:02:06 UTC (rev 19347)
@@ -7,6 +7,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <malloc.h>
#include <mntent.h>
#include <bits/uClibc_mutex.h>
@@ -84,9 +85,7 @@
__UCLIBC_MUTEX_LOCK(mylock);
if (!buff) {
- buff = malloc(BUFSIZ);
- if (!buff)
- abort();
+ buff = __uc_malloc(BUFSIZ);
}
tmp = getmntent_r(filep, &mnt, buff, BUFSIZ);
Modified: trunk/uClibc/libc/misc/regex/regex_old.c
===================================================================
--- trunk/uClibc/libc/misc/regex/regex_old.c 2007-07-30 16:55:05 UTC (rev 19346)
+++ trunk/uClibc/libc/misc/regex/regex_old.c 2007-07-30 17:02:06 UTC (rev 19347)
@@ -35,6 +35,7 @@
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
+#include <malloc.h>
#include <stdio.h>
libc_hidden_proto(memset)
@@ -306,7 +307,7 @@
# 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,12 +315,14 @@
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))
re_syntax_table[c] = Sword;
Modified: trunk/uClibc/libc/misc/ttyent/getttyent.c
===================================================================
--- trunk/uClibc/libc/misc/ttyent/getttyent.c 2007-07-30 16:55:05 UTC (rev 19346)
+++ trunk/uClibc/libc/misc/ttyent/getttyent.c 2007-07-30 17:02:06 UTC (rev 19347)
@@ -34,6 +34,7 @@
#include <ctype.h>
#include <string.h>
#include <stdlib.h>
+#include <malloc.h>
#ifdef __UCLIBC_HAS_THREADS__
#include <pthread.h>
#endif
@@ -132,9 +133,7 @@
return (NULL);
if (!line) {
- line = malloc(BUFSIZ);
- if (!line)
- abort();
+ line = __uc_malloc(BUFSIZ);
}
__STDIO_ALWAYS_THREADLOCK(tf);
More information about the uClibc-cvs
mailing list