summaryrefslogtreecommitdiff
path: root/inet_ntop.c
diff options
context:
space:
mode:
authorYang Tse <yangsita@gmail.com>2006-08-04 02:49:04 +0000
committerYang Tse <yangsita@gmail.com>2006-08-04 02:49:04 +0000
commit857a5f935347c2d86b92920962c123138b50459b (patch)
tree1086bb84c2c76825d6d74a812678e43819c04e64 /inet_ntop.c
parent1a8709fa8d21e164b86137bb5b7b4d7bd9eeb46b (diff)
downloadc-ares-857a5f935347c2d86b92920962c123138b50459b.tar.gz
c-ares-857a5f935347c2d86b92920962c123138b50459b.tar.bz2
c-ares-857a5f935347c2d86b92920962c123138b50459b.zip
Fix compiler warning
Diffstat (limited to 'inet_ntop.c')
-rw-r--r--inet_ntop.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/inet_ntop.c b/inet_ntop.c
index 74192c1..9902391 100644
--- a/inet_ntop.c
+++ b/inet_ntop.c
@@ -129,8 +129,12 @@ inet_ntop6(const unsigned char *src, char *dst, size_t size)
* Keep this in mind if you think this function should have been coded
* to use pointer overlays. All the world's not a VAX.
*/
- char tmp[sizeof "ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255"], *tp;
- struct { int base, len; } best = { 0,0 }, cur = { 0,0 };
+ char tmp[sizeof("ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255")];
+ char *tp;
+ struct {
+ long base;
+ long len;
+ } best, cur;
unsigned int words[NS_IN6ADDRSZ / NS_INT16SZ];
int i;
@@ -142,8 +146,12 @@ inet_ntop6(const unsigned char *src, char *dst, size_t size)
memset(words, '\0', sizeof words);
for (i = 0; i < NS_IN6ADDRSZ; i++)
words[i / 2] |= (src[i] << ((1 - (i % 2)) << 3));
+
best.base = -1;
cur.base = -1;
+ best.len = 0;
+ cur.len = 0;
+
for (i = 0; i < (NS_IN6ADDRSZ / NS_INT16SZ); i++)
{
if (words[i] == 0)