From 5fadc0cbb8577c61d66bd6f19ceaf0507c11e23b Mon Sep 17 00:00:00 2001 From: Jannis Hoffmann Date: Tue, 9 Jul 2024 14:41:53 +0200 Subject: initial clang-format --- src/dnsstub/dns_dfd.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'src/dnsstub/dns_dfd.c') diff --git a/src/dnsstub/dns_dfd.c b/src/dnsstub/dns_dfd.c index 756a1f8..645d068 100644 --- a/src/dnsstub/dns_dfd.c +++ b/src/dnsstub/dns_dfd.c @@ -1,7 +1,7 @@ -#include "error.h" #include "alloc.h" #include "byte.h" #include "dnsresolv.h" +#include "error.h" /** @file dns_dfd.c @@ -10,7 +10,7 @@ @brief domain name qualification (domain from dot) */ -int dns_domain_fromdot(char **out,const char *buf,unsigned int n) +int dns_domain_fromdot(char **out, const char *buf, unsigned int n) { char label[63]; unsigned int labellen = 0; /* <= sizeof label */ @@ -23,30 +23,34 @@ int dns_domain_fromdot(char **out,const char *buf,unsigned int n) for (;;) { if (!n) break; - ch = *buf++; --n; + ch = *buf++; + --n; if (ch == '.') { if (labellen) { if (namelen + labellen + 1 > sizeof(name)) return 0; name[namelen++] = labellen; - byte_copy(name + namelen,labellen,label); + byte_copy(name + namelen, labellen, label); namelen += labellen; labellen = 0; } continue; } - if (ch == '\\') { // octal -> decimal + if (ch == '\\') { // octal -> decimal if (!n) break; - ch = *buf++; --n; + ch = *buf++; + --n; if ((ch >= '0') && (ch <= '7')) { ch -= '0'; if (n && (*buf >= '0') && (*buf <= '7')) { ch <<= 3; ch += *buf - '0'; - ++buf; --n; + ++buf; + --n; if (n && (*buf >= '0') && (*buf <= '7')) { ch <<= 3; ch += *buf - '0'; - ++buf; --n; + ++buf; + --n; } } } @@ -58,7 +62,7 @@ int dns_domain_fromdot(char **out,const char *buf,unsigned int n) if (labellen) { if (namelen + labellen + 1 > sizeof(name)) return 0; name[namelen++] = labellen; - byte_copy(name + namelen,labellen,label); + byte_copy(name + namelen, labellen, label); namelen += labellen; labellen = 0; } @@ -68,7 +72,7 @@ int dns_domain_fromdot(char **out,const char *buf,unsigned int n) x = alloc(namelen); if (!x) return DNS_MEM; - byte_copy(x,namelen,name); + byte_copy(x, namelen, name); if (*out) alloc_free(*out); *out = x; -- cgit v1.2.3