about summary refs log tree commit
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2011-06-03 05:29:49 +0000
committerEric Wong <normalperson@yhbt.net>2011-06-03 05:29:49 +0000
commit12e06682825246f690fc547fd2412ca6c7c4a7bd (patch)
treec4efd4a459f13f275fcf6e549fdac96bcc4949f3
parentd8cb6f5e2eff22d4cb232ffdb10bd8b734726508 (diff)
downloadrpatricia-12e06682825246f690fc547fd2412ca6c7c4a7bd.tar.gz
patricia.c: fix some minor compiler warnings
This way we're less inclined to ignore warnings that may
point to real problems.
-rw-r--r--ext/rpatricia/patricia.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/ext/rpatricia/patricia.c b/ext/rpatricia/patricia.c
index 9913a3f..94d8465 100644
--- a/ext/rpatricia/patricia.c
+++ b/ext/rpatricia/patricia.c
@@ -77,6 +77,8 @@ comp_with_mask (void *addr, void *dest, u_int mask)
 char *
 prefix_toa2x (prefix_t *prefix, char *buff, int with_len)
 {
+    const char *dst;
+
     assert(prefix && "NULL prefix not allowed");
     assert(prefix->ref_count >= 0);
     assert(buff != NULL && "buffer must be specified");
@@ -91,11 +93,11 @@ prefix_toa2x (prefix_t *prefix, char *buff, int with_len)
     default:
         assert(0 && "unknown address family (memory corruption?)");
     }
-    buff = inet_ntop(prefix->family, &prefix->add.sin6, buff, INET6_ADDRSTRLEN);
-    assert(buff && "corrupt address");
+    dst = inet_ntop(prefix->family, &prefix->add.sin6, buff, INET6_ADDRSTRLEN);
+    assert(dst && "corrupt address");
     if (with_len)
         sprintf(buff + strlen(buff), "/%u", prefix->bitlen);
-    return (buff);
+    return buff;
 }
 
 /* prefix_toa2
@@ -488,7 +490,7 @@ patricia_lookup (patricia_tree_t *patricia, prefix_t *prefix)
     /* find the first bit different */
     check_bit = (node->bit < bitlen)? node->bit: bitlen;
     differ_bit = 0;
-    for (i = 0; i*8 < check_bit; i++) {
+    for (i = 0; i*8 < (int)check_bit; i++) {
         if ((r = (addr[i] ^ test_addr[i])) == 0) {
             differ_bit = (i + 1) * 8;
             continue;