summaryrefslogtreecommitdiff
path: root/src/dnsstub/dns_domain.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/dnsstub/dns_domain.c')
-rw-r--r--src/dnsstub/dns_domain.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/src/dnsstub/dns_domain.c b/src/dnsstub/dns_domain.c
index 654a827..4ee7ba3 100644
--- a/src/dnsstub/dns_domain.c
+++ b/src/dnsstub/dns_domain.c
@@ -1,6 +1,6 @@
#include "alloc.h"
-#include "case.h"
#include "byte.h"
+#include "case.h"
#include "dnsresolv.h"
/**
@@ -16,8 +16,7 @@ unsigned int dns_domain_length(const char *dn)
unsigned char c;
x = dn;
- while ((c = *x++))
- x += (unsigned int) c;
+ while ((c = *x++)) x += (unsigned int)c;
return x - dn;
}
@@ -29,7 +28,7 @@ void dns_domain_free(char **out)
}
}
-int dns_domain_copy(char **out,const char *in)
+int dns_domain_copy(char **out, const char *in)
{
unsigned int len;
char *x;
@@ -37,42 +36,42 @@ int dns_domain_copy(char **out,const char *in)
len = dns_domain_length(in);
x = alloc(len);
if (!x) return 0;
- byte_copy(x,len,in);
+ byte_copy(x, len, in);
if (*out) alloc_free(*out);
*out = x;
return 1;
}
-int dns_domain_equal(const char *dn1,const char *dn2)
+int dns_domain_equal(const char *dn1, const char *dn2)
{
unsigned int len;
len = dns_domain_length(dn1);
if (len != dns_domain_length(dn2)) return 0;
- if (case_diffb((char *)dn1,len,(char *)dn2)) return 0; /* safe since 63 < 'A' */
+ if (case_diffb((char *)dn1, len, (char *)dn2)) return 0; /* safe since 63 < 'A' */
return 1;
}
-int dns_domain_suffix(const char *big,const char *little)
+int dns_domain_suffix(const char *big, const char *little)
{
unsigned char c;
for (;;) {
- if (dns_domain_equal(big,little)) return 1;
+ if (dns_domain_equal(big, little)) return 1;
c = *big++;
if (!c) return 0;
big += c;
}
}
-unsigned int dns_domain_suffixpos(const char *big,const char *little)
+unsigned int dns_domain_suffixpos(const char *big, const char *little)
{
const char *orig = big;
unsigned char c;
for (;;) {
- if (dns_domain_equal(big,little)) return big - orig;
+ if (dns_domain_equal(big, little)) return big - orig;
c = *big++;
if (!c) return 0;
big += c;