svn commit: trunk/uClibc/libc: inet misc/mntent
vda at uclibc.org
vda at uclibc.org
Sat Nov 1 23:15:48 UTC 2008
Author: vda
Date: 2008-11-01 16:15:48 -0700 (Sat, 01 Nov 2008)
New Revision: 23892
Log:
trivial code shrink by making some strings static
text data bss dec hex filename
- 259 0 0 259 103 libc/inet/herror.o
+ 243 0 0 243 f3 libc/inet/herror.o
- 720 0 0 720 2d0 libc/inet/ns_name.o
+ 710 0 0 710 2c6 libc/inet/ns_name.o
Modified:
trunk/uClibc/libc/inet/herror.c
trunk/uClibc/libc/inet/resolv.c
trunk/uClibc/libc/misc/mntent/mntent.c
Changeset:
Modified: trunk/uClibc/libc/inet/herror.c
===================================================================
--- trunk/uClibc/libc/inet/herror.c 2008-11-01 13:40:32 UTC (rev 23891)
+++ trunk/uClibc/libc/inet/herror.c 2008-11-01 23:15:48 UTC (rev 23892)
@@ -26,7 +26,7 @@
libc_hidden_proto(fprintf)
libc_hidden_proto(__h_errno_location)
-static const char *error_msg = "Resolver error";
+static const char error_msg[] = "Resolver error";
static const char *const h_errlist[] = {
"Error 0",
"Unknown host", /* 1 HOST_NOT_FOUND */
@@ -52,7 +52,7 @@
}
p = error_msg;
if ((h_errno >= 0) && (h_errno < h_nerr)) {
- p = h_errlist[h_errno];
+ p = h_errlist[h_errno];
}
fprintf(stderr, "%s%s%s\n", s, c, p);
}
@@ -61,10 +61,8 @@
const char *hstrerror(int err)
{
- if (err < 0) {
- return(error_msg);
- } else if (err < h_nerr) {
- return(h_errlist[err]);
- }
- return(error_msg);
+ if ((unsigned)err < h_nerr)
+ return(h_errlist[err]);
+
+ return error_msg;
}
Modified: trunk/uClibc/libc/inet/resolv.c
===================================================================
--- trunk/uClibc/libc/inet/resolv.c 2008-11-01 13:40:32 UTC (rev 23891)
+++ trunk/uClibc/libc/inet/resolv.c 2008-11-01 23:15:48 UTC (rev 23892)
@@ -2625,12 +2625,14 @@
* The root is returned as "."
* All other domains are returned in non absolute form
*/
-int ns_name_ntop(const u_char *src, char *dst, size_t dstsiz) {
+int ns_name_ntop(const u_char *src, char *dst, size_t dstsiz)
+{
+ static const char digits[] = "0123456789";
+
const u_char *cp;
char *dn, *eom;
u_char c;
u_int n;
- const char digits[] = "0123456789";
cp = src;
dn = dst;
Modified: trunk/uClibc/libc/misc/mntent/mntent.c
===================================================================
--- trunk/uClibc/libc/misc/mntent/mntent.c 2008-11-01 13:40:32 UTC (rev 23891)
+++ trunk/uClibc/libc/misc/mntent/mntent.c 2008-11-01 23:15:48 UTC (rev 23892)
@@ -30,8 +30,9 @@
struct mntent *getmntent_r (FILE *filep,
struct mntent *mnt, char *buff, int bufsize)
{
+ static const char sep[] = " \t\n";
+
char *cp, *ptrptr;
- const char *sep = " \t\n";
if (!filep || !mnt || !buff)
return NULL;
More information about the uClibc-cvs
mailing list