trawick 01/03/02 03:38:52
Modified: network_io/unix inet_ntop.c
Log:
use apr_snprintf() instead of sprintf()... glibc_r sprintf()
makes extra syscalls grabbing/releasing a mutex for unknown
reasons
Revision Changes Path
1.6 +2 -4 apr/network_io/unix/inet_ntop.c
Index: inet_ntop.c
===================================================================
RCS file: /home/cvs/apr/network_io/unix/inet_ntop.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- inet_ntop.c 2001/02/25 20:39:35 1.5
+++ inet_ntop.c 2001/03/02 11:38:45 1.6
@@ -49,8 +49,6 @@
#define EAFNOSUPPORT WSAEAFNOSUPPORT
#endif
-#define SPRINTF(x) ((apr_size_t)sprintf x)
-
/*
* WARNING: Don't even consider trying to compile this on a system where
* sizeof(int) < 4. sizeof(int) > 4 is fine; all the world's not a VAX.
@@ -106,7 +104,7 @@
static const char fmt[] = "%u.%u.%u.%u";
char tmp[sizeof "255.255.255.255"];
- if (SPRINTF((tmp, fmt, src[0], src[1], src[2], src[3])) > size) {
+ if (apr_snprintf(tmp, sizeof tmp, fmt, src[0], src[1], src[2], src[3])
> size) {
errno = ENOSPC;
return (NULL);
}
@@ -193,7 +191,7 @@
tp += strlen(tp);
break;
}
- tp += SPRINTF((tp, "%x", words[i]));
+ tp += apr_snprintf(tp, sizeof tp, "%x", words[i]);
}
/* Was it a trailing run of 0x00's? */
if (best.base != -1 && (best.base + best.len) == (IN6ADDRSZ / INT16SZ))