summaryrefslogtreecommitdiff
path: root/inet_ntop.c
diff options
context:
space:
mode:
authorYang Tse <yangsita@gmail.com>2010-12-16 21:27:56 +0100
committerYang Tse <yangsita@gmail.com>2010-12-16 21:27:56 +0100
commit3670427a0b2409518736ffa93bbbee65c3e5f9e2 (patch)
tree8d75c35aff9d59ab868521f7c1bd081ba667a2eb /inet_ntop.c
parent52f493c9311be2a76e7bf0c7e41e3f3ee85419cc (diff)
downloadc-ares-3670427a0b2409518736ffa93bbbee65c3e5f9e2.tar.gz
c-ares-3670427a0b2409518736ffa93bbbee65c3e5f9e2.tar.bz2
c-ares-3670427a0b2409518736ffa93bbbee65c3e5f9e2.zip
ares_inet_ntop: remove definition and usage of macro SPRINTF
Existing definition of SPRINTF always resulted in sprintf() being used, and sprintf() returning 'int' is already used throughout the library.
Diffstat (limited to 'inet_ntop.c')
-rw-r--r--inet_ntop.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/inet_ntop.c b/inet_ntop.c
index 6de0a6d..07d3f5a 100644
--- a/inet_ntop.c
+++ b/inet_ntop.c
@@ -48,12 +48,6 @@
#ifndef HAVE_INET_NTOP
-#ifdef SPRINTF_CHAR
-# define SPRINTF(x) strlen(sprintf/**/x)
-#else
-# define SPRINTF(x) ((size_t)sprintf x)
-#endif
-
/*
* 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.
@@ -107,7 +101,7 @@ inet_ntop4(const unsigned char *src, char *dst, size_t size)
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 ((size_t)sprintf(tmp, fmt, src[0], src[1], src[2], src[3]) >= size) {
SET_ERRNO(ENOSPC);
return (NULL);
}
@@ -194,7 +188,7 @@ inet_ntop6(const unsigned char *src, char *dst, size_t size)
tp += strlen(tp);
break;
}
- tp += SPRINTF((tp, "%x", words[i]));
+ tp += sprintf(tp, "%x", words[i]);
}
/* Was it a trailing run of 0x00's? */
if (best.base != -1 && (best.base + best.len) ==