summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2013-02-13 14:37:16 +0100
committerDaniel Stenberg <daniel@haxx.se>2013-02-13 14:58:04 +0100
commit2a3a63ae1f0894fd33db0c30c75fb2f771d8e7fc (patch)
tree453492a5ef87079694e5b41617f753022beaa042
parent9c03cc118c748f6ed2ffbda83ee7ba37cc34738d (diff)
downloadc-ares-2a3a63ae1f0894fd33db0c30c75fb2f771d8e7fc.tar.gz
c-ares-2a3a63ae1f0894fd33db0c30c75fb2f771d8e7fc.tar.bz2
c-ares-2a3a63ae1f0894fd33db0c30c75fb2f771d8e7fc.zip
ares__bitncmp: use two underscores for private functions
It used a single one previously making it look like a public one
-rw-r--r--ares_gethostbyname.c10
-rw-r--r--bitncmp.c40
-rw-r--r--bitncmp.h6
3 files changed, 27 insertions, 29 deletions
diff --git a/ares_gethostbyname.c b/ares_gethostbyname.c
index 428b1ee..14cf7ef 100644
--- a/ares_gethostbyname.c
+++ b/ares_gethostbyname.c
@@ -460,8 +460,8 @@ static int get_address_index(const struct in_addr *addr,
}
else
{
- if (!ares_bitncmp(&addr->s_addr, &sortlist[i].addrV4.s_addr,
- sortlist[i].mask.bits))
+ if (!ares__bitncmp(&addr->s_addr, &sortlist[i].addrV4.s_addr,
+ sortlist[i].mask.bits))
break;
}
}
@@ -508,10 +508,8 @@ static int get6_address_index(const struct ares_in6_addr *addr,
{
if (sortlist[i].family != AF_INET6)
continue;
- if (!ares_bitncmp(addr,
- &sortlist[i].addrV6,
- sortlist[i].mask.bits))
- break;
+ if (!ares__bitncmp(addr, &sortlist[i].addrV6, sortlist[i].mask.bits))
+ break;
}
return i;
}
diff --git a/bitncmp.c b/bitncmp.c
index 5c89506..faedff9 100644
--- a/bitncmp.c
+++ b/bitncmp.c
@@ -33,27 +33,27 @@
* author:
* Paul Vixie (ISC), June 1996
*/
-int
-ares_bitncmp(const void *l, const void *r, int n) {
- unsigned int lb, rb;
- int x, b;
+int ares__bitncmp(const void *l, const void *r, int n)
+{
+ unsigned int lb, rb;
+ int x, b;
- b = n / 8;
- x = memcmp(l, r, b);
- if (x || (n % 8) == 0)
- return (x);
+ b = n / 8;
+ x = memcmp(l, r, b);
+ if (x || (n % 8) == 0)
+ return (x);
- lb = ((const unsigned char *)l)[b];
- rb = ((const unsigned char *)r)[b];
- for (b = n % 8; b > 0; b--) {
- if ((lb & 0x80) != (rb & 0x80)) {
- if (lb & 0x80)
- return (1);
- return (-1);
- }
- lb <<= 1;
- rb <<= 1;
- }
- return (0);
+ lb = ((const unsigned char *)l)[b];
+ rb = ((const unsigned char *)r)[b];
+ for (b = n % 8; b > 0; b--) {
+ if ((lb & 0x80) != (rb & 0x80)) {
+ if (lb & 0x80)
+ return (1);
+ return (-1);
+ }
+ lb <<= 1;
+ rb <<= 1;
+ }
+ return (0);
}
#endif
diff --git a/bitncmp.h b/bitncmp.h
index b0a5c81..7b8d66c 100644
--- a/bitncmp.h
+++ b/bitncmp.h
@@ -2,7 +2,7 @@
#define __ARES_BITNCMP_H
-/* Copyright (C) 2005 by Dominick Meglio
+/* Copyright (C) 2005, 2013 by Dominick Meglio
*
* Permission to use, copy, modify, and distribute this
* software and its documentation for any purpose and without
@@ -18,9 +18,9 @@
*/
#ifndef HAVE_BITNCMP
-int ares_bitncmp(const void *l, const void *r, int n);
+int ares__bitncmp(const void *l, const void *r, int n);
#else
-#define ares_bitncmp(x,y,z) bitncmp(x,y,z)
+#define ares__bitncmp(x,y,z) bitncmp(x,y,z)
#endif
#endif /* __ARES_BITNCMP_H */