summaryrefslogtreecommitdiff
path: root/src/dnsstub/dns_dtda.c
diff options
context:
space:
mode:
authorJannis Hoffmann <jannis@fehcom.de>2024-07-09 14:41:53 +0200
committerJannis Hoffmann <jannis@fehcom.de>2024-07-09 14:41:53 +0200
commit5fadc0cbb8577c61d66bd6f19ceaf0507c11e23b (patch)
tree684758441f5b431d0008253243034b6a4a29417c /src/dnsstub/dns_dtda.c
parent249866e3d1e11dc72eaa1305f4bb479ded92ef38 (diff)
initial clang-format
Diffstat (limited to 'src/dnsstub/dns_dtda.c')
-rw-r--r--src/dnsstub/dns_dtda.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/src/dnsstub/dns_dtda.c b/src/dnsstub/dns_dtda.c
index 38358a2..13e6051 100644
--- a/src/dnsstub/dns_dtda.c
+++ b/src/dnsstub/dns_dtda.c
@@ -1,5 +1,5 @@
-#include "stralloc.h"
#include "dnsresolv.h"
+#include "stralloc.h"
/**
@file dns_dtda.c
@@ -8,36 +8,36 @@
@brief domain to dot append
*/
-int dns_domain_todot_cat(stralloc *out,const char *d)
+int dns_domain_todot_cat(stralloc *out, const char *d)
{
char ch;
char ch2;
unsigned char ch3;
char buf[4];
- if (!*d)
- return stralloc_append(out,".");
+ if (!*d) return stralloc_append(out, ".");
for (;;) {
ch = *d++;
while (ch--) {
ch2 = *d++;
- if ((ch2 >= 'A') && (ch2 <= 'Z')) ch2 += 32; // FQDN -> lowercase
- if (((ch2 >= 'a') && (ch2 <= 'z')) ||
- ((ch2 >= '0') && (ch2 <= '9')) ||
- (ch2 == '-') || (ch2 == '_')) {
- if (!stralloc_append(out,&ch2)) return DNS_MEM;
- }
- else { // decimal -> octal
+ if ((ch2 >= 'A') && (ch2 <= 'Z')) ch2 += 32; // FQDN -> lowercase
+ if (((ch2 >= 'a') && (ch2 <= 'z')) || ((ch2 >= '0') && (ch2 <= '9')) || (ch2 == '-')
+ || (ch2 == '_'))
+ {
+ if (!stralloc_append(out, &ch2)) return DNS_MEM;
+ } else { // decimal -> octal
ch3 = ch2;
- buf[3] = '0' + (ch3 & 7); ch3 >>= 3;
- buf[2] = '0' + (ch3 & 7); ch3 >>= 3;
+ buf[3] = '0' + (ch3 & 7);
+ ch3 >>= 3;
+ buf[2] = '0' + (ch3 & 7);
+ ch3 >>= 3;
buf[1] = '0' + (ch3 & 7);
buf[0] = '\\';
- if (!stralloc_catb(out,buf,4)) return DNS_MEM;
+ if (!stralloc_catb(out, buf, 4)) return DNS_MEM;
}
}
if (!*d) return 1;
- if (!stralloc_append(out,".")) return DNS_MEM;
+ if (!stralloc_append(out, ".")) return DNS_MEM;
}
}