summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2017-03-11 16:09:55 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2017-03-11 16:09:55 +0000
commit5ad27a3dc4b957191e2e657d41656810138ba789 (patch)
tree07e7e00ab43b74d6a3fdff9ad80e93882921adfa
parentf417b72c9489cd7c20b94eb8904a8911b7f6fd15 (diff)
downloads6-dns-5ad27a3dc4b957191e2e657d41656810138ba789.tar.xz
Adapt to skalibs-2.5.0.0
-rwxr-xr-xconfigure1
-rw-r--r--src/clients/s6-dnsip4-filter.c6
-rw-r--r--src/clients/s6-dnsip4.c14
-rw-r--r--src/clients/s6-dnsip6-filter.c6
-rw-r--r--src/clients/s6-dnsip6.c14
-rw-r--r--src/clients/s6-dnsmx.c16
-rw-r--r--src/clients/s6-dnsname-filter.c6
-rw-r--r--src/clients/s6-dnsname.c10
-rw-r--r--src/clients/s6-dnsns.c12
-rw-r--r--src/clients/s6-dnsq.c18
-rw-r--r--src/clients/s6-dnsqr.c9
-rw-r--r--src/clients/s6-dnsqualify.c8
-rw-r--r--src/clients/s6-dnssoa.c14
-rw-r--r--src/clients/s6-dnssrv.c27
-rw-r--r--src/clients/s6-dnstxt.c9
-rw-r--r--src/clients/s6-randomip.c6
-rw-r--r--src/clients/s6dns_generic_filter_main.c21
-rw-r--r--src/clients/s6dns_namescanner.c2
-rw-r--r--src/include/s6-dns/s6dns-analyze.h2
-rw-r--r--src/include/s6-dns/s6dns-domain.h2
-rw-r--r--src/include/s6-dns/s6dns-fmt.h3
-rw-r--r--src/include/s6-dns/skadns.h2
-rw-r--r--src/libs6dns/s6dns_analyze_packet.c7
-rw-r--r--src/libs6dns/s6dns_analyze_qtype_parse.c8
-rw-r--r--src/libs6dns/s6dns_analyze_record.c11
-rw-r--r--src/libs6dns/s6dns_analyze_record_strings.c2
-rw-r--r--src/libs6dns/s6dns_analyze_record_unknown.c4
-rw-r--r--src/libs6dns/s6dns_constants_error_str.c3
-rw-r--r--src/libs6dns/s6dns_debug_dumpdt_post_send.c2
-rw-r--r--src/libs6dns/s6dns_debug_dumpdt_pre_send.c8
-rw-r--r--src/libs6dns/s6dns_domain_arpafromip4.c10
-rw-r--r--src/libs6dns/s6dns_domain_arpafromip6.c6
-rw-r--r--src/libs6dns/s6dns_domain_decode.c2
-rw-r--r--src/libs6dns/s6dns_domain_encode.c6
-rw-r--r--src/libs6dns/s6dns_domain_encodelist.c2
-rw-r--r--src/libs6dns/s6dns_domain_fromstring.c6
-rw-r--r--src/libs6dns/s6dns_domain_fromstring_noqualify_encode.c2
-rw-r--r--src/libs6dns/s6dns_domain_fromstring_qualify_encode.c1
-rw-r--r--src/libs6dns/s6dns_domain_qualify.c9
-rw-r--r--src/libs6dns/s6dns_domain_tostring.c7
-rw-r--r--src/libs6dns/s6dns_engine.c41
-rw-r--r--src/libs6dns/s6dns_fmt_domainlist.c9
-rw-r--r--src/libs6dns/s6dns_fmt_hinfo.c7
-rw-r--r--src/libs6dns/s6dns_fmt_mx.c7
-rw-r--r--src/libs6dns/s6dns_fmt_soa.c17
-rw-r--r--src/libs6dns/s6dns_fmt_srv.c13
-rw-r--r--src/libs6dns/s6dns_message_counts_pack.c2
-rw-r--r--src/libs6dns/s6dns_message_counts_unpack.c2
-rw-r--r--src/libs6dns/s6dns_message_get_domain_internal.c7
-rw-r--r--src/libs6dns/s6dns_message_get_mx.c2
-rw-r--r--src/libs6dns/s6dns_message_get_soa.c2
-rw-r--r--src/libs6dns/s6dns_message_get_srv.c2
-rw-r--r--src/libs6dns/s6dns_message_get_string_internal.c9
-rw-r--r--src/libs6dns/s6dns_message_get_strings.c6
-rw-r--r--src/libs6dns/s6dns_message_header_pack.c2
-rw-r--r--src/libs6dns/s6dns_message_header_unpack.c2
-rw-r--r--src/libs6dns/s6dns_message_parse.c2
-rw-r--r--src/libs6dns/s6dns_message_parse_answer_domain.c2
-rw-r--r--src/libs6dns/s6dns_message_parse_answer_hinfo.c2
-rw-r--r--src/libs6dns/s6dns_message_parse_answer_mx.c2
-rw-r--r--src/libs6dns/s6dns_message_parse_answer_soa.c2
-rw-r--r--src/libs6dns/s6dns_message_parse_answer_srv.c2
-rw-r--r--src/libs6dns/s6dns_message_parse_answer_strings.c4
-rw-r--r--src/libs6dns/s6dns_message_parse_getrr.c3
-rw-r--r--src/libs6dns/s6dns_message_parse_skipqd.c2
-rw-r--r--src/libs6dns/s6dns_rci_init.c25
-rw-r--r--src/libs6dns/s6dns_resolve_dpag.c2
-rw-r--r--src/libs6dns/s6dns_resolve_mpag.c2
-rw-r--r--src/libs6dns/s6dns_resolve_name4.c2
-rw-r--r--src/libs6dns/s6dns_resolve_name6.c2
-rw-r--r--src/libs6dns/s6dns_resolve_parse.c2
-rw-r--r--src/libs6dns/s6dns_resolven_loop.c2
-rw-r--r--src/libs6dns/s6dns_resolven_parse.c4
-rw-r--r--src/libs6dns/s6dns_resolvenoq_aaaaa.c2
-rw-r--r--src/libs6dns/s6dns_resolveq.c6
-rw-r--r--src/libs6dns/s6dns_resolveq_aaaaa.c12
-rw-r--r--src/skadns/skadns_cancel.c6
-rw-r--r--src/skadns/skadns_end.c2
-rw-r--r--src/skadns/skadns_packet.c2
-rw-r--r--src/skadns/skadns_packetlen.c2
-rw-r--r--src/skadns/skadns_release.c4
-rw-r--r--src/skadns/skadns_send.c17
-rw-r--r--src/skadns/skadns_update.c17
-rw-r--r--src/skadns/skadnsd.c24
84 files changed, 292 insertions, 298 deletions
diff --git a/configure b/configure
index 644c6ce..6145545 100755
--- a/configure
+++ b/configure
@@ -304,6 +304,7 @@ tryflag CPPFLAGS_AUTO -Werror=implicit-function-declaration
tryflag CPPFLAGS_AUTO -Werror=implicit-int
tryflag CPPFLAGS_AUTO -Werror=pointer-sign
tryflag CPPFLAGS_AUTO -Werror=pointer-arith
+tryflag CPPFLAGS_AUTO -Wno-unused-value
tryflag CFLAGS_AUTO -ffunction-sections
tryflag CFLAGS_AUTO -fdata-sections
diff --git a/src/clients/s6-dnsip4-filter.c b/src/clients/s6-dnsip4-filter.c
index 6d6862e..d403f35 100644
--- a/src/clients/s6-dnsip4-filter.c
+++ b/src/clients/s6-dnsip4-filter.c
@@ -1,6 +1,6 @@
/* ISC license. */
-#include <skalibs/bytestr.h>
+#include <string.h>
#include <skalibs/fmtscan.h>
#include <skalibs/strerr2.h>
#include <skalibs/stralloc.h>
@@ -23,7 +23,7 @@ static int s6dns_message_parse_answer_a1 (s6dns_message_rr_t const *rr, char con
{
s6dns_a1_t *data = stuff ;
if (data->got) return 1 ;
- byte_copy(data->ip, 4, packet+pos) ;
+ memcpy(data->ip, packet+pos, 4) ;
data->got = 1 ;
}
(void)packetlen ;
@@ -34,7 +34,7 @@ static int ipformatter (stralloc *sa, char const *packet, unsigned int packetlen
{
s6dns_a1_t data ;
s6dns_message_header_t h ;
- register int r ;
+ int r ;
data.got = 0 ;
r = s6dns_message_parse(&h, packet, packetlen, &s6dns_message_parse_answer_a1, &data) ;
if (r <= 0) return r ;
diff --git a/src/clients/s6-dnsip4.c b/src/clients/s6-dnsip4.c
index 1f1eb28..5d5ef54 100644
--- a/src/clients/s6-dnsip4.c
+++ b/src/clients/s6-dnsip4.c
@@ -1,11 +1,11 @@
/* ISC license. */
-#include <sys/types.h>
+#include <string.h>
#include <errno.h>
-#include <skalibs/uint.h>
+#include <skalibs/types.h>
#include <skalibs/sgetopt.h>
-#include <skalibs/bytestr.h>
#include <skalibs/strerr2.h>
+#include <skalibs/stralloc.h>
#include <skalibs/buffer.h>
#include <skalibs/tai.h>
#include <skalibs/random.h>
@@ -26,7 +26,7 @@ int main (int argc, char const *const *argv)
for (;;)
{
- register int opt = subgetopt(argc, argv, "qrt:") ;
+ int opt = subgetopt(argc, argv, "qrt:") ;
if (opt == -1) break ;
switch (opt)
{
@@ -44,7 +44,7 @@ int main (int argc, char const *const *argv)
tain_add_g(&deadline, &deadline) ;
if (!s6dns_init()) strerr_diefu1sys(111, "s6dns_init") ;
{
- register int r = s6dns_resolve_a_g(&ips, argv[0], str_len(argv[0]), flagqualify, &deadline) ;
+ int r = s6dns_resolve_a_g(&ips, argv[0], strlen(argv[0]), flagqualify, &deadline) ;
if (r < 0) strerr_diefu2sys((errno == ETIMEDOUT) ? 99 : 111, "resolve ", argv[0]) ;
if (!r) strerr_diefu4x(2, "resolve ", argv[0], ": ", s6dns_constants_error_str(errno)) ;
}
@@ -53,9 +53,9 @@ int main (int argc, char const *const *argv)
for (i = 0 ; i < ips.len / 4 ; i++)
{
char fmt[IP4_FMT] ;
- register size_t n = ip4_fmt(fmt, ips.s + 4 * i) ;
+ size_t n = ip4_fmt(fmt, ips.s + 4 * i) ;
fmt[n++] = '\n' ;
- if (buffer_put(buffer_1small, fmt, n) < (int)n)
+ if (buffer_put(buffer_1small, fmt, n) < (ssize_t)n)
strerr_diefu1sys(111, "write to stdout") ;
}
if (!buffer_flush(buffer_1small))
diff --git a/src/clients/s6-dnsip6-filter.c b/src/clients/s6-dnsip6-filter.c
index a5c7418..09b8b20 100644
--- a/src/clients/s6-dnsip6-filter.c
+++ b/src/clients/s6-dnsip6-filter.c
@@ -1,6 +1,6 @@
/* ISC license. */
-#include <skalibs/bytestr.h>
+#include <string.h>
#include <skalibs/fmtscan.h>
#include <skalibs/strerr2.h>
#include <skalibs/stralloc.h>
@@ -23,7 +23,7 @@ static int s6dns_message_parse_answer_aaaa1 (s6dns_message_rr_t const *rr, char
{
s6dns_aaaa1_t *data = stuff ;
if (data->got) return 1 ;
- byte_copy(data->ip, 16, packet+pos) ;
+ memcpy(data->ip, packet+pos, 16) ;
data->got = 1 ;
}
(void)packetlen ;
@@ -34,7 +34,7 @@ static int ipformatter (stralloc *sa, char const *packet, unsigned int packetlen
{
s6dns_aaaa1_t data ;
s6dns_message_header_t h ;
- register int r ;
+ int r ;
data.got = 0 ;
r = s6dns_message_parse(&h, packet, packetlen, &s6dns_message_parse_answer_aaaa1, &data) ;
if (r <= 0) return r ;
diff --git a/src/clients/s6-dnsip6.c b/src/clients/s6-dnsip6.c
index a948b49..62c337b 100644
--- a/src/clients/s6-dnsip6.c
+++ b/src/clients/s6-dnsip6.c
@@ -1,11 +1,11 @@
/* ISC license. */
-#include <sys/types.h>
+#include <string.h>
#include <errno.h>
-#include <skalibs/uint.h>
+#include <skalibs/types.h>
#include <skalibs/sgetopt.h>
-#include <skalibs/bytestr.h>
#include <skalibs/strerr2.h>
+#include <skalibs/stralloc.h>
#include <skalibs/buffer.h>
#include <skalibs/tai.h>
#include <skalibs/random.h>
@@ -26,7 +26,7 @@ int main (int argc, char const *const *argv)
for (;;)
{
- register int opt = subgetopt(argc, argv, "qrt:") ;
+ int opt = subgetopt(argc, argv, "qrt:") ;
if (opt == -1) break ;
switch (opt)
{
@@ -44,7 +44,7 @@ int main (int argc, char const *const *argv)
tain_add_g(&deadline, &deadline) ;
if (!s6dns_init()) strerr_diefu1sys(111, "s6dns_init") ;
{
- register int r = s6dns_resolve_aaaa_g(&ips, argv[0], str_len(argv[0]), flagqualify, &deadline) ;
+ int r = s6dns_resolve_aaaa_g(&ips, argv[0], strlen(argv[0]), flagqualify, &deadline) ;
if (r < 0) strerr_diefu2sys((errno == ETIMEDOUT) ? 99 : 111, "resolve ", argv[0]) ;
if (!r) strerr_diefu4x(2, "resolve ", argv[0], ": ", s6dns_constants_error_str(errno)) ;
}
@@ -53,9 +53,9 @@ int main (int argc, char const *const *argv)
for (i = 0 ; i < ips.len / 16 ; i++)
{
char fmt[IP6_FMT] ;
- register size_t n = ip6_fmt(fmt, ips.s + 16 * i) ;
+ size_t n = ip6_fmt(fmt, ips.s + 16 * i) ;
fmt[n++] = '\n' ;
- if (buffer_put(buffer_1small, fmt, n) < (int)n)
+ if (buffer_put(buffer_1small, fmt, n) < (ssize_t)n)
strerr_diefu1sys(111, "write to stdout") ;
}
if (!buffer_flush(buffer_1small))
diff --git a/src/clients/s6-dnsmx.c b/src/clients/s6-dnsmx.c
index 5b8359c..41fe089 100644
--- a/src/clients/s6-dnsmx.c
+++ b/src/clients/s6-dnsmx.c
@@ -1,10 +1,8 @@
/* ISC license. */
-#include <sys/types.h>
+#include <string.h>
#include <errno.h>
-#include <skalibs/uint16.h>
-#include <skalibs/uint.h>
-#include <skalibs/bytestr.h>
+#include <skalibs/types.h>
#include <skalibs/sgetopt.h>
#include <skalibs/strerr2.h>
#include <skalibs/buffer.h>
@@ -27,7 +25,7 @@ int main (int argc, char const *const *argv)
PROG = "s6-dnsmx" ;
for (;;)
{
- register int opt = subgetopt(argc, argv, "qrt:") ;
+ int opt = subgetopt(argc, argv, "qrt:") ;
if (opt == -1) break ;
switch (opt)
{
@@ -45,7 +43,7 @@ int main (int argc, char const *const *argv)
tain_add_g(&deadline, &deadline) ;
if (!s6dns_init()) strerr_diefu1sys(111, "s6dns_init") ;
{
- register int r = s6dns_resolve_mx_g(&mxs, argv[0], str_len(argv[0]), flagqualify, &deadline) ;
+ int r = s6dns_resolve_mx_g(&mxs, argv[0], strlen(argv[0]), flagqualify, &deadline) ;
if (r < 0) strerr_diefu2sys((errno == ETIMEDOUT) ? 99 : 111, "resolve ", argv[0]) ;
if (!r) strerr_diefu4x(2, "resolve ", argv[0], ": ", s6dns_constants_error_str(errno)) ;
}
@@ -54,10 +52,10 @@ int main (int argc, char const *const *argv)
for (i = 0 ; i < genalloc_len(s6dns_message_rr_mx_t, &mxs) ; i++)
{
char buf[S6DNS_FMT_MX] ;
- register size_t len = s6dns_fmt_mx(buf, S6DNS_FMT_MX, genalloc_s(s6dns_message_rr_mx_t, &mxs) + i) ;
+ size_t len = s6dns_fmt_mx(buf, S6DNS_FMT_MX, genalloc_s(s6dns_message_rr_mx_t, &mxs) + i) ;
if (!len) strerr_diefu1sys(111, "format result") ;
- if (buffer_put(buffer_1, buf, len) < 0) goto err ;
- if (buffer_put(buffer_1, "\n", 1) < 0) goto err ;
+ if (buffer_put(buffer_1, buf, len) < (ssize_t)len) goto err ;
+ if (buffer_put(buffer_1, "\n", 1) < 1) goto err ;
}
if (!buffer_flush(buffer_1)) goto err ;
return 0 ;
diff --git a/src/clients/s6-dnsname-filter.c b/src/clients/s6-dnsname-filter.c
index 0edbe7a..95869be 100644
--- a/src/clients/s6-dnsname-filter.c
+++ b/src/clients/s6-dnsname-filter.c
@@ -16,7 +16,7 @@
static size_t ipscanner (s6dns_domain_t *d, char const *s)
{
char ip[16] ;
- register size_t pos ;
+ size_t pos ;
if (flag6)
{
pos = ip6_scan(s, ip) ;
@@ -53,7 +53,7 @@ static int s6dns_message_parse_answer_domain1 (s6dns_message_rr_t const *rr, cha
if ((section == 2) && (rr->rtype == S6DNS_T_PTR))
{
s6dns_domain1_t *data = stuff ;
- register unsigned int start = pos ;
+ unsigned int start = pos ;
if (data->got) return 1 ;
if (!s6dns_message_get_domain(&data->d, packet, packetlen, &pos)) return 0 ;
if (rr->rdlength != pos - start) return (errno = EPROTO, 0) ;
@@ -66,7 +66,7 @@ static int domainformatter (stralloc *sa, char const *packet, unsigned int packe
{
s6dns_domain1_t data ;
s6dns_message_header_t h ;
- register int r ;
+ int r ;
data.got = 0 ;
r = s6dns_message_parse(&h, packet, packetlen, &s6dns_message_parse_answer_domain1, &data) ;
if (r <= 0) return r ;
diff --git a/src/clients/s6-dnsname.c b/src/clients/s6-dnsname.c
index 103edad..87debde 100644
--- a/src/clients/s6-dnsname.c
+++ b/src/clients/s6-dnsname.c
@@ -2,7 +2,7 @@
#include <sys/types.h>
#include <errno.h>
-#include <skalibs/uint.h>
+#include <skalibs/types.h>
#include <skalibs/sgetopt.h>
#include <skalibs/strerr2.h>
#include <skalibs/buffer.h>
@@ -28,7 +28,7 @@ int main (int argc, char const *const *argv)
PROG = "s6-dnsname" ;
for (;;)
{
- register int opt = subgetopt(argc, argv, "46rt:") ;
+ int opt = subgetopt(argc, argv, "46rt:") ;
if (opt == -1) break ;
switch (opt)
{
@@ -58,7 +58,7 @@ int main (int argc, char const *const *argv)
tain_add_g(&deadline, &deadline) ;
if (!s6dns_init()) strerr_diefu1sys(111, "s6dns_init") ;
{
- register int r = ip.is6 ? s6dns_resolve_name6_g(&ds, ip.ip, &deadline) : s6dns_resolve_name4_g(&ds, ip.ip, &deadline) ;
+ int r = ip.is6 ? s6dns_resolve_name6_g(&ds, ip.ip, &deadline) : s6dns_resolve_name4_g(&ds, ip.ip, &deadline) ;
if (r < 0) strerr_diefu2sys((errno == ETIMEDOUT) ? 99 : 111, "resolve ", argv[0]) ;
if (!r) strerr_diefu4x(2, "resolve ", argv[0], ": ", s6dns_constants_error_str(errno)) ;
}
@@ -68,9 +68,9 @@ int main (int argc, char const *const *argv)
char buf[S6DNS_FMT_DOMAINLIST(genalloc_len(s6dns_domain_t, &ds))] ;
size_t len = s6dns_fmt_domainlist(buf, S6DNS_FMT_DOMAINLIST(genalloc_len(s6dns_domain_t, &ds)), genalloc_s(s6dns_domain_t, &ds), genalloc_len(s6dns_domain_t, &ds), "\n", 1) ;
if (!len) strerr_diefu1sys(111, "format result") ;
- if (buffer_put(buffer_1, buf, len) < 0) goto err ;
+ if (buffer_put(buffer_1, buf, len) < (ssize_t)len) goto err ;
}
- if (buffer_putflush(buffer_1, "\n", 1) < 0) goto err ;
+ if (buffer_putflush(buffer_1, "\n", 1) < 1) goto err ;
return 0 ;
err:
strerr_diefu1sys(111, "write to stdout") ;
diff --git a/src/clients/s6-dnsns.c b/src/clients/s6-dnsns.c
index 6e86b89..b54ff24 100644
--- a/src/clients/s6-dnsns.c
+++ b/src/clients/s6-dnsns.c
@@ -1,9 +1,9 @@
/* ISC license. */
#include <sys/types.h>
+#include <string.h>
#include <errno.h>
-#include <skalibs/uint.h>
-#include <skalibs/bytestr.h>
+#include <skalibs/types.h>
#include <skalibs/sgetopt.h>
#include <skalibs/strerr2.h>
#include <skalibs/buffer.h>
@@ -25,7 +25,7 @@ int main (int argc, char const *const *argv)
PROG = "s6-dnsns" ;
for (;;)
{
- register int opt = subgetopt(argc, argv, "qrt:") ;
+ int opt = subgetopt(argc, argv, "qrt:") ;
if (opt == -1) break ;
switch (opt)
{
@@ -43,7 +43,7 @@ int main (int argc, char const *const *argv)
tain_add_g(&deadline, &deadline) ;
if (!s6dns_init()) strerr_diefu1sys(111, "s6dns_init") ;
{
- register int r = s6dns_resolve_ns_g(&ds, argv[0], str_len(argv[0]), flagqualify, &deadline) ;
+ int r = s6dns_resolve_ns_g(&ds, argv[0], strlen(argv[0]), flagqualify, &deadline) ;
if (r < 0) strerr_diefu2sys((errno == ETIMEDOUT) ? 99 : 111, "resolve ", argv[0]) ;
if (!r) strerr_diefu4x(2, "resolve ", argv[0], ": ", s6dns_constants_error_str(errno)) ;
}
@@ -53,9 +53,9 @@ int main (int argc, char const *const *argv)
char buf[S6DNS_FMT_DOMAINLIST(genalloc_len(s6dns_domain_t, &ds))] ;
size_t len = s6dns_fmt_domainlist(buf, S6DNS_FMT_DOMAINLIST(genalloc_len(s6dns_domain_t, &ds)), genalloc_s(s6dns_domain_t, &ds), genalloc_len(s6dns_domain_t, &ds), "\n", 1) ;
if (!len) strerr_diefu1sys(111, "format result") ;
- if (buffer_put(buffer_1, buf, len) < 0) goto err ;
+ if (buffer_put(buffer_1, buf, len) < (ssize_t)len) goto err ;
}
- if (buffer_putflush(buffer_1, "\n", 1) < 0) goto err ;
+ if (buffer_putflush(buffer_1, "\n", 1) < 1) goto err ;
return 0 ;
err:
strerr_diefu1sys(111, "write to stdout") ;
diff --git a/src/clients/s6-dnsq.c b/src/clients/s6-dnsq.c
index 538c925..9f36716 100644
--- a/src/clients/s6-dnsq.c
+++ b/src/clients/s6-dnsq.c
@@ -1,11 +1,9 @@
/* ISC license. */
-#include <sys/types.h>
+#include <string.h>
#include <stdint.h>
#include <errno.h>
-#include <skalibs/uint16.h>
-#include <skalibs/uint.h>
-#include <skalibs/bytestr.h>
+#include <skalibs/types.h>
#include <skalibs/bitarray.h>
#include <skalibs/strerr2.h>
#include <skalibs/sgetopt.h>
@@ -32,7 +30,7 @@ int main (int argc, char const *const *argv)
unsigned int t = 0 ;
for (;;)
{
- register int opt = subgetopt_r(argc, argv, "12t:D:", &l) ;
+ int opt = subgetopt_r(argc, argv, "12t:D:", &l) ;
if (opt == -1) break ;
switch (opt)
{
@@ -54,21 +52,21 @@ int main (int argc, char const *const *argv)
unsigned int i = 0, j = 0 ;
qtype = s6dns_analyze_qtype_parse(argv[0]) ;
if (!qtype) dieusage() ;
- if (!s6dns_domain_fromstring_noqualify_encode(&d, argv[1], str_len(argv[1])))
+ if (!s6dns_domain_fromstring_noqualify_encode(&d, argv[1], strlen(argv[1])))
strerr_diefu2sys(100, "encode ", argv[1]) ;
dbh.external = where ;
- byte_zero(&servers, sizeof(s6dns_ip46list_t)) ;
+ memset(&servers, 0, sizeof(s6dns_ip46list_t)) ;
for (; (i < (unsigned int)(argc - 2)) && (j < S6DNS_MAX_SERVERS) ; i++)
{
ip46_t z[S6DNS_MAX_SERVERS] ;
- unsigned int n ; /* XXX: depends on ip46_scanlist API */
- register unsigned int k = 0 ;
+ size_t n ;
+ unsigned int k = 0 ;
if (!*argv[2+i]) continue ;
if (!ip46_scanlist(z, S6DNS_MAX_SERVERS - j, argv[2 + i], &n))
strerr_diefu2sys(100, "make an IP address list out of ", argv[2+i]) ;
for (; k < n ; k++)
{
- byte_copy(s6dns_ip46list_ip(&servers, j + k), SKALIBS_IP_SIZE, z[k].ip) ;
+ memcpy(s6dns_ip46list_ip(&servers, j + k), z[k].ip, SKALIBS_IP_SIZE) ;
#ifdef SKALIBS_IPV6_ENABLED
if (ip46_is6(z + k)) bitarray_set(servers.is6, j + k) ;
#endif
diff --git a/src/clients/s6-dnsqr.c b/src/clients/s6-dnsqr.c
index f1bb896..ed66ff9 100644
--- a/src/clients/s6-dnsqr.c
+++ b/src/clients/s6-dnsqr.c
@@ -1,10 +1,9 @@
/* ISC license. */
+#include <string.h>
#include <stdint.h>
#include <errno.h>
-#include <skalibs/uint16.h>
-#include <skalibs/uint.h>
-#include <skalibs/bytestr.h>
+#include <skalibs/types.h>
#include <skalibs/strerr2.h>
#include <skalibs/sgetopt.h>
#include <skalibs/buffer.h>
@@ -28,7 +27,7 @@ int main (int argc, char const *const *argv)
unsigned int t = 0 ;
for (;;)
{
- register int opt = subgetopt_r(argc, argv, "12t:D:", &l) ;
+ int opt = subgetopt_r(argc, argv, "12t:D:", &l) ;
if (opt == -1) break ;
switch (opt)
{
@@ -48,7 +47,7 @@ int main (int argc, char const *const *argv)
s6dns_domain_t d ;
uint16_t qtype = s6dns_analyze_qtype_parse(argv[0]) ;
if (!qtype) dieusage() ;
- if (!s6dns_domain_fromstring_noqualify_encode(&d, argv[1], str_len(argv[1])))
+ if (!s6dns_domain_fromstring_noqualify_encode(&d, argv[1], strlen(argv[1])))
strerr_diefu2sys(100, "encode ", argv[1]) ;
dbh.external = where ;
if (debuglevel & 1) dbh.post_recv = &s6dns_debug_dumpdt_post_recv ;
diff --git a/src/clients/s6-dnsqualify.c b/src/clients/s6-dnsqualify.c
index 94405db..74d1c9b 100644
--- a/src/clients/s6-dnsqualify.c
+++ b/src/clients/s6-dnsqualify.c
@@ -1,7 +1,7 @@
/* ISC license. */
#include <sys/types.h>
-#include <skalibs/bytestr.h>
+#include <string.h>
#include <skalibs/strerr2.h>
#include <skalibs/buffer.h>
#include <s6-dns/s6dns.h>
@@ -14,7 +14,7 @@ int main (int argc, char const *const *argv)
s6dns_domain_t d ;
PROG = "s6-dnsqualify" ;
if (argc < 2) dieusage() ;
- if (!s6dns_domain_fromstring(&d, argv[1], str_len(argv[1])))
+ if (!s6dns_domain_fromstring(&d, argv[1], strlen(argv[1])))
strerr_diefu2sys(100, "make a domain name from ", argv[1]) ;
if (!s6dns_init()) strerr_diefu1sys(111, "s6dns_init") ;
{
@@ -25,10 +25,10 @@ int main (int argc, char const *const *argv)
char buf[S6DNS_FMT_DOMAINLIST(n)] ;
size_t len = s6dns_fmt_domainlist(buf, S6DNS_FMT_DOMAINLIST(n), list, n, "\n", 1) ;
if (!len) strerr_diefu1sys(111, "format result") ;
- if (buffer_put(buffer_1, buf, len) < 0) goto err ;
+ if (buffer_put(buffer_1, buf, len) < (ssize_t)len) goto err ;
}
}
- if (buffer_putflush(buffer_1, "\n", 1) < 0) goto err ;
+ if (buffer_putflush(buffer_1, "\n", 1) < 1) goto err ;
return 0 ;
err:
strerr_diefu1sys(111, "write to stdout") ;
diff --git a/src/clients/s6-dnssoa.c b/src/clients/s6-dnssoa.c
index e620c85..68fa4d4 100644
--- a/src/clients/s6-dnssoa.c
+++ b/src/clients/s6-dnssoa.c
@@ -1,9 +1,9 @@
/* ISC license. */
#include <sys/types.h>
+#include <string.h>
#include <errno.h>
-#include <skalibs/uint.h>
-#include <skalibs/bytestr.h>
+#include <skalibs/types.h>
#include <skalibs/sgetopt.h>
#include <skalibs/strerr2.h>
#include <skalibs/buffer.h>
@@ -26,7 +26,7 @@ int main (int argc, char const *const *argv)
PROG = "s6-dnssoa" ;
for (;;)
{
- register int opt = subgetopt(argc, argv, "qrt:") ;
+ int opt = subgetopt(argc, argv, "qrt:") ;
if (opt == -1) break ;
switch (opt)
{
@@ -44,7 +44,7 @@ int main (int argc, char const *const *argv)
tain_add_g(&deadline, &deadline) ;
if (!s6dns_init()) strerr_diefu1sys(111, "s6dns_init") ;
{
- register int r = s6dns_resolve_soa_g(&soas, argv[0], str_len(argv[0]), flagqualify, &deadline) ;
+ int r = s6dns_resolve_soa_g(&soas, argv[0], strlen(argv[0]), flagqualify, &deadline) ;
if (r < 0) strerr_diefu2sys((errno == ETIMEDOUT) ? 99 : 111, "resolve ", argv[0]) ;
if (!r) strerr_diefu4x(2, "resolve ", argv[0], ": ", s6dns_constants_error_str(errno)) ;
}
@@ -53,10 +53,10 @@ int main (int argc, char const *const *argv)
for (i = 0 ; i < genalloc_len(s6dns_message_rr_soa_t, &soas) ; i++)
{
char buf[S6DNS_FMT_SOA] ;
- register size_t len = s6dns_fmt_soa(buf, S6DNS_FMT_SOA, genalloc_s(s6dns_message_rr_soa_t, &soas) + i) ;
+ size_t len = s6dns_fmt_soa(buf, S6DNS_FMT_SOA, genalloc_s(s6dns_message_rr_soa_t, &soas) + i) ;
if (!len) strerr_diefu1sys(111, "format result") ;
- if (buffer_put(buffer_1, buf, len) < 0) goto err ;
- if (buffer_put(buffer_1, "\n", 1) < 0) goto err ;
+ if (buffer_put(buffer_1, buf, len) < (ssize_t)len) goto err ;
+ if (buffer_put(buffer_1, "\n", 1) < 1) goto err ;
}
if (!buffer_flush(buffer_1)) goto err ;
return 0 ;
diff --git a/src/clients/s6-dnssrv.c b/src/clients/s6-dnssrv.c
index 47f5df0..ecc3db6 100644
--- a/src/clients/s6-dnssrv.c
+++ b/src/clients/s6-dnssrv.c
@@ -1,9 +1,9 @@
/* ISC license. */
#include <sys/types.h>
+#include <string.h>
#include <errno.h>
-#include <skalibs/uint.h>
-#include <skalibs/bytestr.h>
+#include <skalibs/types.h>
#include <skalibs/sgetopt.h>
#include <skalibs/strerr2.h>
#include <skalibs/buffer.h>
@@ -26,7 +26,7 @@ int main (int argc, char const *const *argv)
PROG = "s6-dnssrv" ;
for (;;)
{
- register int opt = subgetopt(argc, argv, "qt:") ;
+ int opt = subgetopt(argc, argv, "qt:") ;
if (opt == -1) break ;
switch (opt)
{
@@ -44,19 +44,20 @@ int main (int argc, char const *const *argv)
tain_add_g(&deadline, &deadline) ;
if (!s6dns_init()) strerr_diefu1sys(111, "s6dns_init") ;
{
- size_t n0 = str_len(argv[0]) ;
- size_t n1 = str_len(argv[1]) ;
- size_t n2 = str_len(argv[2]) ;
+ size_t n0 = strlen(argv[0]) ;
+ size_t n1 = strlen(argv[1]) ;
+ size_t n2 = strlen(argv[2]) ;
+ int r ;
char name[n0 + n1 + n2 + 5] ;
name[0] = '_' ;
- byte_copy(name + 1, n0, argv[0]) ;
+ memcpy(name + 1, argv[0], n0) ;
name[n0 + 1] = '.' ;
name[n0 + 2] = '_' ;
- byte_copy(name + n0 + 3, n1, argv[1]) ;
+ memcpy(name + n0 + 3, argv[1], n1) ;
name[n0 + n1 + 3] = '.' ;
- byte_copy(name + n0 + n1 + 4, n2, argv[2]) ;
+ memcpy(name + n0 + n1 + 4, argv[2], n2) ;
name[n0 + n1 + n2 + 4] = 0 ;
- register int r = s6dns_resolve_srv_g(&srvs, name, n0 + n1 + n2 + 4, flagqualify, &deadline) ;
+ r = s6dns_resolve_srv_g(&srvs, name, n0 + n1 + n2 + 4, flagqualify, &deadline) ;
if (r < 0) strerr_diefu2sys((errno == ETIMEDOUT) ? 99 : 111, "resolve ", argv[0]) ;
if (!r) strerr_diefu4x(2, "resolve ", name, ": ", s6dns_constants_error_str(errno)) ;
}
@@ -65,10 +66,10 @@ int main (int argc, char const *const *argv)
for (i = 0 ; i < genalloc_len(s6dns_message_rr_srv_t, &srvs) ; i++)
{
char buf[S6DNS_FMT_SRV] ;
- register size_t len = s6dns_fmt_srv(buf, S6DNS_FMT_SRV, genalloc_s(s6dns_message_rr_srv_t, &srvs) + i) ;
+ size_t len = s6dns_fmt_srv(buf, S6DNS_FMT_SRV, genalloc_s(s6dns_message_rr_srv_t, &srvs) + i) ;
if (!len) strerr_diefu1sys(111, "format result") ;
- if (buffer_put(buffer_1, buf, len) < 0) goto err ;
- if (buffer_put(buffer_1, "\n", 1) < 0) goto err ;
+ if (buffer_put(buffer_1, buf, len) < (ssize_t)len) goto err ;
+ if (buffer_put(buffer_1, "\n", 1) < 1) goto err ;
}
if (!buffer_flush(buffer_1)) goto err ;
return 0 ;
diff --git a/src/clients/s6-dnstxt.c b/src/clients/s6-dnstxt.c
index 5ee1427..df5aee1 100644
--- a/src/clients/s6-dnstxt.c
+++ b/src/clients/s6-dnstxt.c
@@ -1,9 +1,8 @@
/* ISC license. */
-#include <sys/types.h>
+#include <string.h>
#include <errno.h>
-#include <skalibs/uint.h>
-#include <skalibs/bytestr.h>
+#include <skalibs/types.h>
#include <skalibs/sgetopt.h>
#include <skalibs/strerr2.h>
#include <skalibs/buffer.h>
@@ -31,7 +30,7 @@ int main (int argc, char const *const *argv)
PROG = "s6-dnstxt" ;
for (;;)
{
- register int opt = subgetopt(argc, argv, "qrt:") ;
+ int opt = subgetopt(argc, argv, "qrt:") ;
if (opt == -1) break ;
switch (opt)
{
@@ -49,7 +48,7 @@ int main (int argc, char const *const *argv)
tain_add(&deadline, &deadline, &stamp) ;
if (!s6dns_init()) strerr_diefu1sys(111, "s6dns_init") ;
{
- register int r = s6dns_resolve_txt(&sa, &offsets, argv[0], str_len(argv[0]), flagqualify, &deadline, &stamp) ;
+ int r = s6dns_resolve_txt(&sa, &offsets, argv[0], strlen(argv[0]), flagqualify, &deadline, &stamp) ;
if (r < 0) strerr_diefu2sys((errno == ETIMEDOUT) ? 99 : 111, "resolve ", argv[0]) ;
if (!r) strerr_diefu4x(2, "resolve ", argv[0], ": ", s6dns_constants_error_str(errno)) ;
}
diff --git a/src/clients/s6-randomip.c b/src/clients/s6-randomip.c
index 95ce042..7103443 100644
--- a/src/clients/s6-randomip.c
+++ b/src/clients/s6-randomip.c
@@ -2,7 +2,7 @@
#include <sys/types.h>
#include <errno.h>
-#include <skalibs/uint.h>
+#include <skalibs/types.h>
#include <skalibs/sgetopt.h>
#include <skalibs/strerr2.h>
#include <skalibs/buffer.h>
@@ -23,7 +23,7 @@ int main (int argc, char const *const *argv)
PROG = "s6-randomip" ;
for (;;)
{
- register int opt = subgetopt(argc, argv, "46n:") ;
+ int opt = subgetopt(argc, argv, "46n:") ;
if (opt == -1) break ;
switch (opt)
{
@@ -51,7 +51,7 @@ int main (int argc, char const *const *argv)
random_string(ip, len) ;
len = (len == 16) ? ip6_fmt(fmt, ip) : ip4_fmt(fmt, ip) ;
fmt[len++] = '\n' ;
- if (buffer_put(buffer_1, fmt, len) < (int)len)
+ if (buffer_put(buffer_1, fmt, len) < (ssize_t)len)
strerr_diefu1sys(111, "write to stdout") ;
}
if (!buffer_flush(buffer_1))
diff --git a/src/clients/s6dns_generic_filter_main.c b/src/clients/s6dns_generic_filter_main.c
index 6d51e67..ba9534e 100644
--- a/src/clients/s6dns_generic_filter_main.c
+++ b/src/clients/s6dns_generic_filter_main.c
@@ -4,8 +4,7 @@
#include <stdint.h>
#include <errno.h>
#include <skalibs/error.h>
-#include <skalibs/uint16.h>
-#include <skalibs/uint.h>
+#include <skalibs/types.h>
#include <skalibs/sgetopt.h>
#include <skalibs/strerr2.h>
#include <skalibs/env.h>
@@ -57,7 +56,7 @@ int s6dns_generic_filter_main (int argc, char const *const *argv, char const *co
unsigned int t = 0 ;
for (;;)
{
- register int opt = subgetopt_r(argc, argv, (qtype == S6DNS_T_PTR) ? "46l:c:t:f:e:" : "l:c:t:f:e:", &l) ;
+ int opt = subgetopt_r(argc, argv, (qtype == S6DNS_T_PTR) ? "46l:c:t:f:e:" : "l:c:t:f:e:", &l) ;
if (opt == -1) break ;
switch (opt)
{
@@ -127,18 +126,18 @@ int s6dns_generic_filter_main (int argc, char const *const *argv, char const *co
if (x[2].revents)
{
- register int j = 0 ;
- register uint16_t const *list ;
+ int j = 0 ;
+ uint16_t const *list ;
int n = skadns_update(&a) ;
if (n < 0) strerr_diefu1sys(111, "skadns_update") ;
list = skadns_list(&a) ;
for (; j < n ; j++)
{
- register uint16_t i = lineindex[list[j]] ;
- register char const *packet = skadns_packet(&a, list[j]) ;
+ uint16_t i = lineindex[list[j]] ;
+ char const *packet = skadns_packet(&a, list[j]) ;
if (packet)
{
- register int r ;
+ int r ;
r = (*formatter)(&storage[i].swrd, packet, skadns_packetlen(&a, list[j])) ;
if (r < 0) strerr_diefu1sys(111, "format skadns answer") ;
if (!r) storage[i].dpos = -errno ;
@@ -159,8 +158,8 @@ int s6dns_generic_filter_main (int argc, char const *const *argv, char const *co
for (; (numlines < maxlines) && (pending < maxconn) ; lhead = (lhead+1) % (maxlines+1), numlines++)
{
s6dns_domain_t d ;
- register line_t *line = storage + lhead ;
- register int r = skagetln(buffer_0, &line->swrd, '\n') ;
+ line_t *line = storage + lhead ;
+ int r = skagetln(buffer_0, &line->swrd, '\n') ;
if (r < 0)
{
if (error_isagain(errno)) break ;
@@ -211,7 +210,7 @@ int s6dns_generic_filter_main (int argc, char const *const *argv, char const *co
for (; ltail != lhead ; ltail = (ltail+1) % (maxlines+1), numlines--)
{
char *args[4] ;
- register line_t *line = storage + ltail ;
+ line_t *line = storage + ltail ;
if (line->pending) break ;
args[0] = line->swrd.s ;
args[1] = line->dpos < 0 ? (char *)s6dns_constants_error_str(-line->dpos) : line->swrd.s + line->dpos ;
diff --git a/src/clients/s6dns_namescanner.c b/src/clients/s6dns_namescanner.c
index c2110d2..2df6aae 100644
--- a/src/clients/s6dns_namescanner.c
+++ b/src/clients/s6dns_namescanner.c
@@ -8,7 +8,7 @@
size_t s6dns_namescanner (s6dns_domain_t *d, char const *s)
{
- register size_t pos = 0 ;
+ size_t pos = 0 ;
while (s[pos] && (s[pos] != ' ') && (s[pos] != '\t') && (s[pos] != '\r') && (s[pos] != '\n')) pos++ ;
if (pos > UINT_MAX) return (errno = ENAMETOOLONG, 0) ;
if (!s6dns_domain_fromstring_noqualify_encode(d, s, pos)) return 0 ;
diff --git a/src/include/s6-dns/s6dns-analyze.h b/src/include/s6-dns/s6dns-analyze.h
index ff74025..35f34cf 100644
--- a/src/include/s6-dns/s6dns-analyze.h
+++ b/src/include/s6-dns/s6dns-analyze.h
@@ -18,7 +18,7 @@ struct s6dns_analyze_rtypetable_s
s6dns_analyze_record_func_t_ref f ;
} ;
-extern uint16 s6dns_analyze_qtype_parse (char const *) ;
+extern uint16_t s6dns_analyze_qtype_parse (char const *) ;
extern s6dns_analyze_rtypetable_t const *s6dns_analyze_rtypetable ;
diff --git a/src/include/s6-dns/s6dns-domain.h b/src/include/s6-dns/s6dns-domain.h
index d5ed077..2fcbe53 100644
--- a/src/include/s6-dns/s6dns-domain.h
+++ b/src/include/s6-dns/s6dns-domain.h
@@ -3,7 +3,7 @@
#ifndef S6DNS_DOMAIN_H
#define S6DNS_DOMAIN_H
-#include <sys/types.h>
+#include <string.h>
#include <skalibs/ip46.h>
typedef struct s6dns_domain_s s6dns_domain_t, *s6dns_domain_t_ref ;
diff --git a/src/include/s6-dns/s6dns-fmt.h b/src/include/s6-dns/s6dns-fmt.h
index e9d379b..4be81ec 100644
--- a/src/include/s6-dns/s6dns-fmt.h
+++ b/src/include/s6-dns/s6dns-fmt.h
@@ -4,8 +4,7 @@
#define S6DNS_FMT_H
#include <sys/types.h>
-#include <skalibs/uint16.h>
-#include <skalibs/uint32.h>
+#include <skalibs/types.h>
#include <s6-dns/s6dns-domain.h>
#include <s6-dns/s6dns-message.h>
diff --git a/src/include/s6-dns/skadns.h b/src/include/s6-dns/skadns.h
index 04803ea..b2a5aff 100644
--- a/src/include/s6-dns/skadns.h
+++ b/src/include/s6-dns/skadns.h
@@ -65,6 +65,6 @@ extern int skadns_update (skadns_t *) ;
#define skadns_clearlist(a) ((a)->list.len = 0)
extern int skadns_packetlen (skadns_t const *, uint16_t) ;
extern char const *skadns_packet (skadns_t const *, uint16_t) ;
-extern int skadns_release (skadns_t *, uint16) ;
+extern int skadns_release (skadns_t *, uint16_t) ;
#endif
diff --git a/src/libs6dns/s6dns_analyze_packet.c b/src/libs6dns/s6dns_analyze_packet.c
index 11c14e6..57e7f95 100644
--- a/src/libs6dns/s6dns_analyze_packet.c
+++ b/src/libs6dns/s6dns_analyze_packet.c
@@ -1,18 +1,17 @@
/* ISC license. */
+#include <string.h>
#include <stdint.h>
#include <errno.h>
#include <skalibs/error.h>
-#include <skalibs/uint16.h>
-#include <skalibs/uint.h>
-#include <skalibs/bytestr.h>
+#include <skalibs/types.h>
#include <skalibs/genwrite.h>
#include <s6-dns/s6dns-constants.h>
#include <s6-dns/s6dns-domain.h>
#include <s6-dns/s6dns-message.h>
#include <s6-dns/s6dns-analyze.h>
-#define add(s) if ((*gp->put)(gp->target, (s), str_len(s)) < 0) return 0
+#define add(s) if ((*gp->put)(gp->target, (s), strlen(s)) < 0) return 0
#define addfmt(n) if ((*gp->put)(gp->target, fmt, uint_fmt(fmt, (n))) < 0) return 0
#define addfmt16(n) if ((*gp->put)(gp->target, fmt, uint16_fmt(fmt, (n))) < 0) return 0
diff --git a/src/libs6dns/s6dns_analyze_qtype_parse.c b/src/libs6dns/s6dns_analyze_qtype_parse.c
index 383dcde..8ae86ad 100644
--- a/src/libs6dns/s6dns_analyze_qtype_parse.c
+++ b/src/libs6dns/s6dns_analyze_qtype_parse.c
@@ -1,8 +1,8 @@
/* ISC license. */
#include <stdint.h>
-#include <skalibs/uint16.h>
-#include <skalibs/bytestr.h>
+#include <strings.h>
+#include <skalibs/types.h>
#include <s6-dns/s6dns-constants.h>
#include <s6-dns/s6dns-analyze.h>
@@ -40,8 +40,8 @@ uint16_t s6dns_analyze_qtype_parse (char const *s)
if (uint160_scan(s, &u)) return u ;
}
{
- register lookuptable_t const *p = table ;
- for (; p->text ; p++) if (case_equals(s, p->text)) return p->qtype ;
+ lookuptable_t const *p = table ;
+ for (; p->text ; p++) if (!strcasecmp(s, p->text)) return p->qtype ;
}
return 0 ;
}
diff --git a/src/libs6dns/s6dns_analyze_record.c b/src/libs6dns/s6dns_analyze_record.c
index ecc5c26..e2621f7 100644
--- a/src/libs6dns/s6dns_analyze_record.c
+++ b/src/libs6dns/s6dns_analyze_record.c
@@ -1,9 +1,8 @@
/* ISC license. */
+#include <string.h>
#include <stdint.h>
-#include <skalibs/uint16.h>
-#include <skalibs/uint32.h>
-#include <skalibs/bytestr.h>
+#include <skalibs/types.h>
#include <skalibs/genwrite.h>
#include <s6-dns/s6dns-domain.h>
#include <s6-dns/s6dns-message.h>
@@ -11,7 +10,7 @@
static s6dns_analyze_rtypetable_t const *rtypelookup (uint16_t rtype)
{
- register s6dns_analyze_rtypetable_t const *wut = s6dns_analyze_rtypetable ;
+ s6dns_analyze_rtypetable_t const *wut = s6dns_analyze_rtypetable ;
while (wut->rtype && wut->rtype != rtype) wut++ ;
return wut ;
}
@@ -21,7 +20,7 @@ int s6dns_analyze_record (genwrite_t *gp, s6dns_message_rr_t const *rr, char con
s6dns_analyze_rtypetable_t const *wut = rtypelookup(rr->rtype) ;
{
char buf[256] ;
- register unsigned int n = s6dns_domain_tostring(buf, 256, &rr->name) ;
+ unsigned int n = s6dns_domain_tostring(buf, 256, &rr->name) ;
if (!n) return 0 ;
if ((*gp->put)(gp->target, buf, n) < 0) return 0 ;
}
@@ -30,7 +29,7 @@ int s6dns_analyze_record (genwrite_t *gp, s6dns_message_rr_t const *rr, char con
if ((*gp->put)(gp->target, fmt, 1 + uint32_fmt(fmt+1, rr->ttl)) < 0) return 0 ;
}
if ((*gp->put)(gp->target, " ", 1) < 0) return 0 ;
- if ((*gp->put)(gp->target, wut->string, str_len(wut->string)) < 0) return 0 ;
+ if ((*gp->put)(gp->target, wut->string, strlen(wut->string)) < 0) return 0 ;
if ((*gp->put)(gp->target, " ", 1) < 0) return 0 ;
if (!(*wut->f)(gp, rr, packet, packetlen, pos)) return 0 ;
if ((*gp->put)(gp->target, "\n", 1) < 0) return 0 ;
diff --git a/src/libs6dns/s6dns_analyze_record_strings.c b/src/libs6dns/s6dns_analyze_record_strings.c
index c2aa15a..a5df9e6 100644
--- a/src/libs6dns/s6dns_analyze_record_strings.c
+++ b/src/libs6dns/s6dns_analyze_record_strings.c
@@ -13,7 +13,7 @@ int s6dns_analyze_record_strings (genwrite_t *gp, s6dns_message_rr_t const *rr,
stralloc sa = STRALLOC_ZERO ;
char buf[rr->rdlength] ;
unsigned int pos = start ;
- register int r = s6dns_message_get_strings(buf, rr->rdlength, packet, packetlen, &pos) ;
+ int r = s6dns_message_get_strings(buf, rr->rdlength, packet, packetlen, &pos) ;
if (r < 0) return 0 ;
if (rr->rdlength != pos - start) return (errno = EPROTO, 0) ;
if (!string_quote(&sa, buf, r)) return 0 ;
diff --git a/src/libs6dns/s6dns_analyze_record_unknown.c b/src/libs6dns/s6dns_analyze_record_unknown.c
index 07b2941..8e27dc4 100644
--- a/src/libs6dns/s6dns_analyze_record_unknown.c
+++ b/src/libs6dns/s6dns_analyze_record_unknown.c
@@ -1,7 +1,7 @@
/* ISC license. */
#include <stdint.h>
-#include <skalibs/uint16.h>
+#include <skalibs/types.h>
#include <skalibs/fmtscan.h>
#include <skalibs/genwrite.h>
#include <s6-dns/s6dns-message.h>
@@ -16,7 +16,7 @@ int s6dns_analyze_record_unknown (genwrite_t *gp, s6dns_message_rr_t const *rr,
if ((*gp->put)(gp->target, fmt, uint16_fmt(fmt, rr->rdlength)) < 0) return 0 ;
if ((*gp->put)(gp->target, ": ", 2) < 0) return 0 ;
{
- register uint16_t i = 0 ;
+ uint16_t i = 0 ;
for (; i < rr->rdlength ; i++)
if ((*gp->put)(gp->target, fmt, ucharn_fmt(fmt, packet + pos + i, 1)) < 0)
return 0 ;
diff --git a/src/libs6dns/s6dns_constants_error_str.c b/src/libs6dns/s6dns_constants_error_str.c
index 6d477c2..2c6c072 100644
--- a/src/libs6dns/s6dns_constants_error_str.c
+++ b/src/libs6dns/s6dns_constants_error_str.c
@@ -1,5 +1,6 @@
/* ISC license. */
+#include <string.h>
#include <skalibs/error.h>
#include <s6-dns/s6dns-constants.h>
@@ -7,5 +8,5 @@ char const *s6dns_constants_error_str (int e)
{
s6dns_constants_error_message_t const *p = s6dns_constants_error ;
while ((p->num != e) && (p->num != -1)) p++ ;
- return p->num == -1 ? error_str(e) : p->string ;
+ return p->num == -1 ? strerror(e) : p->string ;
}
diff --git a/src/libs6dns/s6dns_debug_dumpdt_post_send.c b/src/libs6dns/s6dns_debug_dumpdt_post_send.c
index 5e7b60c..27e4ff9 100644
--- a/src/libs6dns/s6dns_debug_dumpdt_post_send.c
+++ b/src/libs6dns/s6dns_debug_dumpdt_post_send.c
@@ -2,7 +2,7 @@
#include <sys/types.h>
#include <stdint.h>
-#include <skalibs/uint16.h>
+#include <skalibs/types.h>
#include <skalibs/djbtime.h>
#include <skalibs/genwrite.h>
#include <s6-dns/s6dns-engine.h>
diff --git a/src/libs6dns/s6dns_debug_dumpdt_pre_send.c b/src/libs6dns/s6dns_debug_dumpdt_pre_send.c
index 1cd6e6e..5e1c60a 100644
--- a/src/libs6dns/s6dns_debug_dumpdt_pre_send.c
+++ b/src/libs6dns/s6dns_debug_dumpdt_pre_send.c
@@ -8,7 +8,7 @@
#include <sys/types.h>
#include <stdint.h>
#include <errno.h>
-#include <skalibs/uint16.h>
+#include <skalibs/types.h>
#include <skalibs/fmtscan.h>
#include <skalibs/tai.h>
#include <skalibs/djbtime.h>
@@ -38,7 +38,7 @@ int s6dns_debug_dumpdt_pre_send (s6dns_engine_t const *dt, void *data)
if ((*gp->put)(gp->target, len ? "cache" : "server", len ? 5 : 6) < (len ? 5 : 6)) return 0 ;
if ((*gp->put)(gp->target, " ", 1) < 1) return 0 ;
len = s6dns_ipfmt(buf, s6dns_ip46list_ip(&dt->servers, dt->curserver), s6dns_ip46list_is6(&dt->servers, dt->curserver)) ;
- if ((*gp->put)(gp->target, buf, len) < (int)len) return 0 ;
+ if ((*gp->put)(gp->target, buf, len) < (ssize_t)len) return 0 ;
if ((*gp->put)(gp->target, " with deadline ", 15) < 15) return 0 ;
{
localtmn_t l ;
@@ -49,7 +49,7 @@ int s6dns_debug_dumpdt_pre_send (s6dns_engine_t const *dt, void *data)
}
else len = localtmn_fmt(buf, &l) ;
}
- if ((*gp->put)(gp->target, buf, len) < (int)len) return 0 ;
+ if ((*gp->put)(gp->target, buf, len) < (ssize_t)len) return 0 ;
if ((*gp->put)(gp->target, ", ", 2) < 2) return 0 ;
if (dt->flagstrict && (*gp->put)(gp->target, "strict, ", 8) < 8) return 0 ;
if ((*gp->put)(gp->target, "query id ", 9) < 9) return 0 ;
@@ -58,7 +58,7 @@ int s6dns_debug_dumpdt_pre_send (s6dns_engine_t const *dt, void *data)
uint16_unpack_big(dt->sa.s + 2, &id) ;
len = uint16_fmt(buf, id) ;
}
- if ((*gp->put)(gp->target, buf, len) < (int)len) return 0 ;
+ if ((*gp->put)(gp->target, buf, len) < (ssize_t)len) return 0 ;
if ((*gp->put)(gp->target, ":\n", 2) < 2) return 0 ;
if (!s6dns_analyze_packet(gp, dt->sa.s + 2, dt->querylen - 2, 1)) return 0 ;
if ((*gp->put)(gp->target, "\n", 1) < 1) return 0 ;
diff --git a/src/libs6dns/s6dns_domain_arpafromip4.c b/src/libs6dns/s6dns_domain_arpafromip4.c
index d77938f..07cd7bd 100644
--- a/src/libs6dns/s6dns_domain_arpafromip4.c
+++ b/src/libs6dns/s6dns_domain_arpafromip4.c
@@ -1,19 +1,19 @@
/* ISC license. */
-#include <skalibs/bytestr.h>
-#include <skalibs/uint.h>
+#include <string.h>
+#include <skalibs/types.h>
#include <s6-dns/s6dns-domain.h>
void s6dns_domain_arpafromip4 (s6dns_domain_t *d, char const *ip)
{
- register unsigned int i = 0 ;
+ unsigned int i = 0 ;
d->len = 0 ;
d->s[d->len++] = '.' ;
for (; i < 4 ; i++)
{
- register unsigned int u = ((unsigned char *)ip)[3-i] ;
+ unsigned int u = ((unsigned char *)ip)[3-i] ;
d->len += uint_fmt(d->s + d->len, u) ;
d->s[d->len++] = '.' ;
}
- byte_copy(d->s + d->len, 13, "in-addr.arpa.") ; d->len += 13 ;
+ memcpy(d->s + d->len, "in-addr.arpa.", 13) ; d->len += 13 ;
}
diff --git a/src/libs6dns/s6dns_domain_arpafromip6.c b/src/libs6dns/s6dns_domain_arpafromip6.c
index 3b58127..594eb69 100644
--- a/src/libs6dns/s6dns_domain_arpafromip6.c
+++ b/src/libs6dns/s6dns_domain_arpafromip6.c
@@ -1,12 +1,12 @@
/* ISC license. */
-#include <skalibs/bytestr.h>
+#include <string.h>
#include <skalibs/fmtscan.h>
#include <s6-dns/s6dns-domain.h>
void s6dns_domain_arpafromip6 (s6dns_domain_t *d, char const *ip6, unsigned int mask)
{
- register unsigned int i ;
+ unsigned int i ;
if (mask > 128) mask = 128 ;
mask = mask ? 1 + ((mask-1) >> 2) : 0 ;
d->len = 0 ;
@@ -17,5 +17,5 @@ void s6dns_domain_arpafromip6 (s6dns_domain_t *d, char const *ip6, unsigned int
d->s[d->len++] = fmtscan_asc((i & 1) ? (c >> 4) : (c & 15)) ;
d->s[d->len++] = '.' ;
}
- byte_copy(d->s + d->len, 9, "ip6.arpa.") ; d->len += 9 ;
+ memcpy(d->s + d->len, "ip6.arpa.", 9) ; d->len += 9 ;
}
diff --git a/src/libs6dns/s6dns_domain_decode.c b/src/libs6dns/s6dns_domain_decode.c
index db4ccf5..440f672 100644
--- a/src/libs6dns/s6dns_domain_decode.c
+++ b/src/libs6dns/s6dns_domain_decode.c
@@ -20,7 +20,7 @@ int s6dns_domain_decode (s6dns_domain_t *d)
unsigned int pos = 0 ;
for (;;)
{
- register unsigned int r = s6dns_domain_label_decode(d->s + pos, max - pos) ;
+ unsigned int r = s6dns_domain_label_decode(d->s + pos, max - pos) ;
if (!r) return 0 ;
pos += r ;
if (r == 1) break ;
diff --git a/src/libs6dns/s6dns_domain_encode.c b/src/libs6dns/s6dns_domain_encode.c
index 61a790d..a551d23 100644
--- a/src/libs6dns/s6dns_domain_encode.c
+++ b/src/libs6dns/s6dns_domain_encode.c
@@ -6,12 +6,12 @@
int s6dns_domain_encode (s6dns_domain_t *d)
{
- register char *s = d->s ;
- register unsigned int len = d->len ;
+ char *s = d->s ;
+ unsigned int len = d->len ;
if (!d->len || (*s != '.')) return (errno = EINVAL, 0) ;
while (len > 1)
{
- register unsigned int n = byte_chr(s + 1, len - 1, '.') ;
+ unsigned int n = byte_chr(s + 1, len - 1, '.') ;
if (n > 63) return (errno = EINVAL, 0) ;
*s = n++ ; s += n ; len -= n ;
}
diff --git a/src/libs6dns/s6dns_domain_encodelist.c b/src/libs6dns/s6dns_domain_encodelist.c
index 23b4570..1f98dbc 100644
--- a/src/libs6dns/s6dns_domain_encodelist.c
+++ b/src/libs6dns/s6dns_domain_encodelist.c
@@ -4,7 +4,7 @@
unsigned int s6dns_domain_encodelist (s6dns_domain_t *list, unsigned int n)
{
- register unsigned int i = 0 ;
+ unsigned int i = 0 ;
for (; i < n ; i++)
if (!s6dns_domain_encode(list + i)) break ;
return i ;
diff --git a/src/libs6dns/s6dns_domain_fromstring.c b/src/libs6dns/s6dns_domain_fromstring.c
index 92f3117..b87ee10 100644
--- a/src/libs6dns/s6dns_domain_fromstring.c
+++ b/src/libs6dns/s6dns_domain_fromstring.c
@@ -1,14 +1,14 @@
/* ISC license. */
-#include <sys/types.h>
+#include <string.h>
#include <errno.h>
#include <skalibs/bytestr.h>
#include <s6-dns/s6dns-domain.h>
int s6dns_domain_fromstring (s6dns_domain_t *d, char const *s, size_t len)
{
- register size_t j = 1 ;
- register size_t i = 0 ;
+ size_t j = 1 ;
+ size_t i = 0 ;
unsigned int lastdot = 0 ;
d->s[0] = '.' ;
for (; i < len ; i++)
diff --git a/src/libs6dns/s6dns_domain_fromstring_noqualify_encode.c b/src/libs6dns/s6dns_domain_fromstring_noqualify_encode.c
index eb5b55a..96e9858 100644
--- a/src/libs6dns/s6dns_domain_fromstring_noqualify_encode.c
+++ b/src/libs6dns/s6dns_domain_fromstring_noqualify_encode.c
@@ -1,6 +1,6 @@
/* ISC license. */
-#include <sys/types.h>
+#include <string.h>
#include <s6-dns/s6dns-domain.h>
int s6dns_domain_fromstring_noqualify_encode (s6dns_domain_t *d, char const *name, size_t len)
diff --git a/src/libs6dns/s6dns_domain_fromstring_qualify_encode.c b/src/libs6dns/s6dns_domain_fromstring_qualify_encode.c
index d57a521..cb958f0 100644
--- a/src/libs6dns/s6dns_domain_fromstring_qualify_encode.c
+++ b/src/libs6dns/s6dns_domain_fromstring_qualify_encode.c
@@ -1,5 +1,6 @@
/* ISC license. */
+#include <string.h>
#include <s6-dns/s6dns-domain.h>
unsigned int s6dns_domain_fromstring_qualify_encode (s6dns_domain_t *list, char const *name, size_t len, char const *rules, unsigned int rulesnum)
diff --git a/src/libs6dns/s6dns_domain_qualify.c b/src/libs6dns/s6dns_domain_qualify.c
index 8f036be..ae66978 100644
--- a/src/libs6dns/s6dns_domain_qualify.c
+++ b/src/libs6dns/s6dns_domain_qualify.c
@@ -1,8 +1,7 @@
/* ISC license. */
-#include <sys/types.h>
+#include <string.h>
#include <errno.h>
-#include <skalibs/bytestr.h>
#include <s6-dns/s6dns-domain.h>
unsigned int s6dns_domain_qualify (s6dns_domain_t *list, s6dns_domain_t const *d, char const *rules, unsigned int rulesnum)
@@ -15,14 +14,14 @@ unsigned int s6dns_domain_qualify (s6dns_domain_t *list, s6dns_domain_t const *d
}
else
{
- register unsigned int i = 0 ;
+ unsigned int i = 0 ;
for (; i < rulesnum ; i++)
{
- size_t n = str_len(rules) ;
+ size_t n = strlen(rules) ;
if (d->len + n >= 254) return (errno = ENAMETOOLONG, 0) ;
list[i] = *d ;
list[i].s[d->len] = '.' ;
- byte_copy(list[i].s + d->len + 1, n, rules) ;
+ memcpy(list[i].s + d->len + 1, rules, n) ;
list[i].len += n+1 ;
rules += n+1 ;
}
diff --git a/src/libs6dns/s6dns_domain_tostring.c b/src/libs6dns/s6dns_domain_tostring.c
index d5de7ae..e11715b 100644
--- a/src/libs6dns/s6dns_domain_tostring.c
+++ b/src/libs6dns/s6dns_domain_tostring.c
@@ -1,13 +1,12 @@
/* ISC license. */
-#include <sys/types.h>
+#include <string.h>
#include <errno.h>
-#include <skalibs/bytestr.h>
#include <s6-dns/s6dns-domain.h>
unsigned int s6dns_domain_tostring (char *s, size_t max, s6dns_domain_t const *d)
{
- if ((unsigned int)d->len + 1 > max) return (errno = ENAMETOOLONG, 0) ;
+ if ((size_t)d->len + 1 > max) return (errno = ENAMETOOLONG, 0) ;
if (!d->len || (d->s[0] != '.')) return (errno = EINVAL, 0) ;
if (d->len == 1)
{
@@ -16,7 +15,7 @@ unsigned int s6dns_domain_tostring (char *s, size_t max, s6dns_domain_t const *d
}
else
{
- byte_copy(s, d->len - 1, d->s + 1) ;
+ memcpy(s, d->s + 1, d->len - 1) ;
return d->len - 1 ;
}
}
diff --git a/src/libs6dns/s6dns_engine.c b/src/libs6dns/s6dns_engine.c
index 71fc200..baf93b0 100644
--- a/src/libs6dns/s6dns_engine.c
+++ b/src/libs6dns/s6dns_engine.c
@@ -1,11 +1,12 @@
/* ISC license. */
#include <sys/types.h>
+#include <string.h>
+#include <strings.h>
#include <stdint.h>
#include <errno.h>
-#include <skalibs/uint16.h>
+#include <skalibs/types.h>
#include <skalibs/allreadwrite.h>
-#include <skalibs/bytestr.h>
#include <skalibs/error.h>
#include <skalibs/tai.h>
#include <skalibs/stralloc.h>
@@ -25,7 +26,7 @@
static inline int qdomain_diff (char const *s1, size_t n1, char const *s2, size_t n2)
{
- return (n1 < n2) ? -1 : (n1 > n2) ? 1 : case_diffb(s1, n1, s2) ;
+ return (n1 < n2) ? -1 : (n1 > n2) ? 1 : strncasecmp(s1, s2, n1) ;
}
static int relevant (char const *q, unsigned int qlen, char const *ans, unsigned int anslen, int strict)
@@ -56,7 +57,7 @@ static int relevant (char const *q, unsigned int qlen, char const *ans, unsigned
LOLDEBUG(" testing answer domain against query") ;
if (qdomain_diff(buf, n, q + 12, qlen - 16)) return 0 ;
LOLDEBUG(" testing answer qclass and qtype against query" ) ;
- if (byte_diff(q + qlen - 4, 4, ans + pos)) return 0 ;
+ if (memcmp(q + qlen - 4, ans + pos, 4)) return 0 ;
}
LOLDEBUG("relevant() returns 1") ;
return 1 ;
@@ -81,7 +82,7 @@ static int relevant (char const *q, unsigned int qlen, char const *ans, unsigned
static int randombind (int fd, int flag)
{
- register unsigned int i = 0 ;
+ unsigned int i = 0 ;
for (; i < 10 ; i++)
if (socketbind46(fd, S6DNS_ENGINE_LOCAL0, 1025 + random_uint32(64510), flag) >= 0) return 1 ;
return (socketbind46(fd, S6DNS_ENGINE_LOCAL0, 0, flag) >= 0) ;
@@ -96,14 +97,14 @@ static int thisudp (s6dns_engine_t *dt, tain_t const *stamp)
dt->curserver = 0 ;
if (++dt->protostate >= 4) return -2 ;
}
- if (byte_diff(s6dns_ip46list_ip(&dt->servers, dt->curserver), SKALIBS_IP_SIZE, S6DNS_ENGINE_LOCAL0)) break ;
+ if (memcmp(s6dns_ip46list_ip(&dt->servers, dt->curserver), S6DNS_ENGINE_LOCAL0, SKALIBS_IP_SIZE)) break ;
}
random_string(dt->sa.s + 2, 2) ; /* random query id */
dt->fd = socketudp46(s6dns_ip46list_is6(&dt->servers, dt->curserver)) ;
if (dt->fd < 0) return -1 ;
if (!randombind(dt->fd, s6dns_ip46list_is6(&dt->servers, dt->curserver)))
{
- register int e = errno ;
+ int e = errno ;
fd_close(dt->fd) ; dt->fd = -1 ;
errno = e ;
return -1 ;
@@ -111,7 +112,7 @@ static int thisudp (s6dns_engine_t *dt, tain_t const *stamp)
if ((socketconnect46(dt->fd, s6dns_ip46list_ip(&dt->servers, dt->curserver), 53, s6dns_ip46list_is6(&dt->servers, dt->curserver)) < 0)
&& (errno != EINPROGRESS))
{
- register int e = errno ;
+ int e = errno ;
fd_close(dt->fd) ; dt->fd = -1 ;
errno = e ;
return 0 ;
@@ -127,14 +128,14 @@ static int thisudp (s6dns_engine_t *dt, tain_t const *stamp)
static int thistcp (s6dns_engine_t *dt, tain_t const *stamp)
{
for (; dt->curserver < S6DNS_MAX_SERVERS ; dt->curserver++)
- if (byte_diff(s6dns_ip46list_ip(&dt->servers, dt->curserver), SKALIBS_IP_SIZE, S6DNS_ENGINE_LOCAL0)) break ;
+ if (memcmp(s6dns_ip46list_ip(&dt->servers, dt->curserver), S6DNS_ENGINE_LOCAL0, SKALIBS_IP_SIZE)) break ;
if (dt->curserver >= S6DNS_MAX_SERVERS) return -2 ;
random_string(dt->sa.s + 2, 2) ;
dt->fd = sockettcp46(s6dns_ip46list_is6(&dt->servers, dt->curserver)) ;
if (dt->fd < 0) return -1 ;
if (!randombind(dt->fd, s6dns_ip46list_is6(&dt->servers, dt->curserver)))
{
- register int e = errno ;
+ int e = errno ;
fd_close(dt->fd) ; dt->fd = -1 ;
errno = e ;
return -1 ;
@@ -142,7 +143,7 @@ static int thistcp (s6dns_engine_t *dt, tain_t const *stamp)
if ((socketconnect46(dt->fd, s6dns_ip46list_ip(&dt->servers, dt->curserver), 53, s6dns_ip46list_is6(&dt->servers, dt->curserver)) < 0)
&& (errno != EINPROGRESS))
{
- register int e = errno ;
+ int e = errno ;
fd_close(dt->fd) ; dt->fd = -1 ;
errno = e ;
return 0 ;
@@ -185,7 +186,7 @@ static void prepare_next (s6dns_engine_t *dt, tain_t const *stamp, int istcp)
static int s6dns_engine_write_udp (s6dns_engine_t *dt, tain_t const *stamp)
{
static unsigned int const s6dns_engine_udp_timeouts[4] = { 1, 3, 11, 45 } ;
- if (fd_send(dt->fd, dt->sa.s + 2, dt->querylen - 2, 0) < (int)(dt->querylen - 2))
+ if (fd_send(dt->fd, dt->sa.s + 2, dt->querylen - 2, 0) < (ssize_t)(dt->querylen - 2))
return (prepare_next(dt, stamp, 0), 0) ;
tain_addsec(&dt->localdeadline, stamp, s6dns_engine_udp_timeouts[dt->protostate]) ;
dt->flagwriting = 0 ;
@@ -197,7 +198,7 @@ static int s6dns_engine_write_udp (s6dns_engine_t *dt, tain_t const *stamp)
static int s6dns_engine_write_tcp (s6dns_engine_t *dt, tain_t const *stamp)
{
- unsigned int r ;
+ size_t r ;
r = allwrite(dt->fd, dt->sa.s + dt->protostate, dt->querylen - dt->protostate) ;
dt->protostate += r ;
if (r) dt->flagconnecting = 0 ;
@@ -220,7 +221,7 @@ static int s6dns_engine_read_udp (s6dns_engine_t *dt, tain_t const *stamp)
{
s6dns_message_header_t h ;
char buf[513] ;
- register ssize_t r = fd_recv(dt->fd, buf, 513, 0) ;
+ ssize_t r = fd_recv(dt->fd, buf, 513, 0) ;
if (r < 0) return (prepare_next(dt, stamp, 0), 0) ;
if ((r > 512) || (r < 12)) return (errno = EAGAIN, 0) ;
switch (relevant(dt->sa.s + 2, dt->querylen - 2, buf, r, dt->flagstrict))
@@ -249,12 +250,12 @@ static int s6dns_engine_read_udp (s6dns_engine_t *dt, tain_t const *stamp)
{
case 0 : case 3 : break ; /* normal operation */
case 1 : case 4 : case 5 :
- byte_zero(s6dns_ip46list_ip(&dt->servers, dt->curserver), SKALIBS_IP_SIZE) ; /* do not query it again */
+ memset(s6dns_ip46list_ip(&dt->servers, dt->curserver), 0, SKALIBS_IP_SIZE) ; /* do not query it again */
default : prepare_next(dt, stamp, 0) ; return 0 ;
}
if (!stralloc_copyb(&dt->sa, buf, r))
{
- register int e = errno ;
+ int e = errno ;
fd_close(dt->fd) ; dt->fd = -1 ;
errno = e ;
return 0 ;
@@ -267,7 +268,7 @@ static int s6dns_engine_read_udp (s6dns_engine_t *dt, tain_t const *stamp)
static int s6dns_engine_read_tcp (s6dns_engine_t *dt, tain_t const *stamp)
{
- register ssize_t r = sanitize_read(mininetstring_read(dt->fd, &dt->sa, &dt->protostate)) ;
+ ssize_t r = sanitize_read(mininetstring_read(dt->fd, &dt->sa, &dt->protostate)) ;
if (r < 0) return (prepare_next(dt, stamp, 1), 0) ;
else if (!r) return (errno = EAGAIN, 0) ;
else if ((dt->sa.len - dt->querylen) < 12)
@@ -292,7 +293,7 @@ static int s6dns_engine_read_tcp (s6dns_engine_t *dt, tain_t const *stamp)
{
case 0 : case 3 : break ; /* normal operation */
case 1 : case 4 : case 5 :
- byte_zero(s6dns_ip46list_ip(&dt->servers, dt->curserver), SKALIBS_IP_SIZE) ; /* do not query it again */
+ memset(s6dns_ip46list_ip(&dt->servers, dt->curserver), 0, SKALIBS_IP_SIZE) ; /* do not query it again */
default : goto badanswer ;
}
fd_close(dt->fd) ; dt->fd = -1 ;
@@ -310,10 +311,10 @@ void s6dns_engine_recycle (s6dns_engine_t *dt)
{
dt->sa.len = 0 ;
dt->querylen = 0 ;
- byte_zero(&dt->servers, sizeof(s6dns_ip46list_t)) ;
+ memset(&dt->servers, 0, sizeof(s6dns_ip46list_t)) ;
if (dt->fd >= 0)
{
- register int e = errno ;
+ int e = errno ;
fd_close(dt->fd) ; dt->fd = -1 ;
errno = e ;
}
diff --git a/src/libs6dns/s6dns_fmt_domainlist.c b/src/libs6dns/s6dns_fmt_domainlist.c
index 625e149..22d6f77 100644
--- a/src/libs6dns/s6dns_fmt_domainlist.c
+++ b/src/libs6dns/s6dns_fmt_domainlist.c
@@ -1,24 +1,23 @@
/* ISC license. */
-#include <sys/types.h>
+#include <string.h>
#include <errno.h>
-#include <skalibs/bytestr.h>
#include <s6-dns/s6dns-domain.h>
#include <s6-dns/s6dns-fmt.h>
size_t s6dns_fmt_domainlist (char *s, size_t max, s6dns_domain_t const *list, unsigned int n, char const *delim, size_t delimlen)
{
size_t len = 0 ;
- register unsigned int i = 0 ;
+ unsigned int i = 0 ;
for (; i < n ; i++)
{
- register unsigned int r = s6dns_domain_tostring(s + len, max - len, list + i) ;
+ unsigned int r = s6dns_domain_tostring(s + len, max - len, list + i) ;
if (!r) return 0 ;
len += r ;
if (i+1 < n)
{
if (len + delimlen > max) return (errno = ENAMETOOLONG, 0) ;
- byte_copy(s + len, delimlen, delim) ;
+ memcpy(s + len, delim, delimlen) ;
len += delimlen ;
}
}
diff --git a/src/libs6dns/s6dns_fmt_hinfo.c b/src/libs6dns/s6dns_fmt_hinfo.c
index 2389926..78bf414 100644
--- a/src/libs6dns/s6dns_fmt_hinfo.c
+++ b/src/libs6dns/s6dns_fmt_hinfo.c
@@ -1,16 +1,15 @@
/* ISC license. */
-#include <sys/types.h>
+#include <string.h>
#include <errno.h>
-#include <skalibs/bytestr.h>
#include <s6-dns/s6dns-message.h>
#include <s6-dns/s6dns-fmt.h>
size_t s6dns_fmt_hinfo (char *s, size_t max, s6dns_message_rr_hinfo_t const *hinfo)
{
if (hinfo->cpu.len + 1 + hinfo->os.len > max) return (errno = ENAMETOOLONG, 0) ;
- byte_copy(s, hinfo->cpu.len, hinfo->cpu.s) ;
+ memcpy(s, hinfo->cpu.s, hinfo->cpu.len) ;
s[hinfo->cpu.len] = ' ' ;
- byte_copy(s + hinfo->cpu.len + 1, hinfo->os.len, hinfo->os.s) ;
+ memcpy(s + hinfo->cpu.len + 1, hinfo->os.s, hinfo->os.len) ;
return hinfo->cpu.len + 1 + hinfo->os.len ;
}
diff --git a/src/libs6dns/s6dns_fmt_mx.c b/src/libs6dns/s6dns_fmt_mx.c
index 303c545..938c478 100644
--- a/src/libs6dns/s6dns_fmt_mx.c
+++ b/src/libs6dns/s6dns_fmt_mx.c
@@ -1,8 +1,7 @@
/* ISC license. */
-#include <sys/types.h>
-#include <skalibs/uint16.h>
-#include <skalibs/bytestr.h>
+#include <string.h>
+#include <skalibs/types.h>
#include <s6-dns/s6dns-message.h>
#include <s6-dns/s6dns-fmt.h>
@@ -15,6 +14,6 @@ size_t s6dns_fmt_mx (char *s, size_t max, s6dns_message_rr_mx_t const *mx)
fmt[len++] = ' ' ;
r = s6dns_domain_tostring(s + len, max - len, &mx->exchange) ;
if (!r) return 0 ;
- byte_copy(s, len, fmt) ;
+ memcpy(s, fmt, len) ;
return len + r ;
}
diff --git a/src/libs6dns/s6dns_fmt_soa.c b/src/libs6dns/s6dns_fmt_soa.c
index b07ae14..b9e0a42 100644
--- a/src/libs6dns/s6dns_fmt_soa.c
+++ b/src/libs6dns/s6dns_fmt_soa.c
@@ -1,9 +1,8 @@
/* ISC license. */
-#include <sys/types.h>
+#include <string.h>
#include <errno.h>
-#include <skalibs/uint32.h>
-#include <skalibs/bytestr.h>
+#include <skalibs/types.h>
#include <s6-dns/s6dns-message.h>
#include <s6-dns/s6dns-fmt.h>
@@ -11,7 +10,7 @@ size_t s6dns_fmt_soa (char *s, size_t max, s6dns_message_rr_soa_t const *soa)
{
size_t len = 0 ;
char fmt[UINT32_FMT] ;
- register size_t r = s6dns_domain_tostring(s + len, max - len, &soa->mname) ;
+ size_t r = s6dns_domain_tostring(s + len, max - len, &soa->mname) ;
if (!r) return 0 ;
len += r ;
if (len >= max) return (errno = ENAMETOOLONG, 0) ;
@@ -23,23 +22,23 @@ size_t s6dns_fmt_soa (char *s, size_t max, s6dns_message_rr_soa_t const *soa)
s[len++] = ' ' ;
r = uint32_fmt(fmt, soa->serial) ;
if (len + r >= max) return (errno = ENAMETOOLONG, 0) ;
- byte_copy(s + len, r, fmt) ;
+ memcpy(s + len, fmt, r) ;
len += r ; s[len++] = ' ' ;
r = uint32_fmt(fmt, soa->refresh) ;
if (len + r >= max) return (errno = ENAMETOOLONG, 0) ;
- byte_copy(s + len, r, fmt) ;
+ memcpy(s + len, fmt, r) ;
len += r ; s[len++] = ' ' ;
r = uint32_fmt(fmt, soa->retry) ;
if (len + r >= max) return (errno = ENAMETOOLONG, 0) ;
- byte_copy(s + len, r, fmt) ;
+ memcpy(s + len, fmt, r) ;
len += r ; s[len++] = ' ' ;
r = uint32_fmt(fmt, soa->expire) ;
if (len + r >= max) return (errno = ENAMETOOLONG, 0) ;
- byte_copy(s + len, r, fmt) ;
+ memcpy(s + len, fmt, r) ;
len += r ; s[len++] = ' ' ;
r = uint32_fmt(fmt, soa->minimum) ;
if (len + r > max) return (errno = ENAMETOOLONG, 0) ;
- byte_copy(s + len, r, fmt) ;
+ memcpy(s + len, fmt, r) ;
len += r ;
return len ;
}
diff --git a/src/libs6dns/s6dns_fmt_srv.c b/src/libs6dns/s6dns_fmt_srv.c
index 33bfd49..ee0d337 100644
--- a/src/libs6dns/s6dns_fmt_srv.c
+++ b/src/libs6dns/s6dns_fmt_srv.c
@@ -1,9 +1,8 @@
/* ISC license. */
-#include <sys/types.h>
+#include <string.h>
#include <errno.h>
-#include <skalibs/uint16.h>
-#include <skalibs/bytestr.h>
+#include <skalibs/types.h>
#include <s6-dns/s6dns-message.h>
#include <s6-dns/s6dns-fmt.h>
@@ -11,17 +10,17 @@ size_t s6dns_fmt_srv (char *s, size_t max, s6dns_message_rr_srv_t const *srv)
{
size_t len = 0 ;
char fmt[UINT16_FMT] ;
- register size_t r = uint16_fmt(fmt, srv->priority) ;
+ size_t r = uint16_fmt(fmt, srv->priority) ;
if (len + r >= max) return (errno = ENAMETOOLONG, 0) ;
- byte_copy(s + len, r, fmt) ;
+ memcpy(s + len, fmt, r) ;
len += r ; s[len++] = ' ' ;
r = uint16_fmt(fmt, srv->weight) ;
if (len + r >= max) return (errno = ENAMETOOLONG, 0) ;
- byte_copy(s + len, r, fmt) ;
+ memcpy(s + len, fmt, r) ;
len += r ; s[len++] = ' ' ;
r = uint16_fmt(fmt, srv->port) ;
if (len + r >= max) return (errno = ENAMETOOLONG, 0) ;
- byte_copy(s + len, r, fmt) ;
+ memcpy(s + len, fmt, r) ;
len += r ; s[len++] = ' ' ;
r = s6dns_domain_tostring(s + len, max - len, &srv->target) ;
if (!r) return 0 ;
diff --git a/src/libs6dns/s6dns_message_counts_pack.c b/src/libs6dns/s6dns_message_counts_pack.c
index 51c0a78..512e8ae 100644
--- a/src/libs6dns/s6dns_message_counts_pack.c
+++ b/src/libs6dns/s6dns_message_counts_pack.c
@@ -1,6 +1,6 @@
/* ISC license. */
-#include <skalibs/uint16.h>
+#include <skalibs/types.h>
#include <s6-dns/s6dns-message.h>
void s6dns_message_counts_pack (char *s, s6dns_message_counts_t const *counts)
diff --git a/src/libs6dns/s6dns_message_counts_unpack.c b/src/libs6dns/s6dns_message_counts_unpack.c
index 968e5eb..ad773ef 100644
--- a/src/libs6dns/s6dns_message_counts_unpack.c
+++ b/src/libs6dns/s6dns_message_counts_unpack.c
@@ -1,6 +1,6 @@
/* ISC license. */
-#include <skalibs/uint16.h>
+#include <skalibs/types.h>
#include <s6-dns/s6dns-message.h>
void s6dns_message_counts_unpack (char const *s, s6dns_message_counts_t *counts)
diff --git a/src/libs6dns/s6dns_message_get_domain_internal.c b/src/libs6dns/s6dns_message_get_domain_internal.c
index 64e71dc..fd36e18 100644
--- a/src/libs6dns/s6dns_message_get_domain_internal.c
+++ b/src/libs6dns/s6dns_message_get_domain_internal.c
@@ -1,9 +1,8 @@
/* ISC license. */
-#include <sys/types.h>
+#include <string.h>
#include <errno.h>
#include <skalibs/error.h>
-#include <skalibs/bytestr.h>
#include "s6dns-message-internal.h"
size_t s6dns_message_get_domain_internal (char *out, size_t outmax, char const *s, unsigned int len, unsigned int *pos)
@@ -11,7 +10,7 @@ size_t s6dns_message_get_domain_internal (char *out, size_t outmax, char const *
size_t w = 0 ; /* writing head */
unsigned int r = *pos ; /* reading head */
unsigned int jumps = 0 ;
- register int hasjumped = 0 ;
+ int hasjumped = 0 ;
for (;;)
{
unsigned char c ;
@@ -23,7 +22,7 @@ size_t s6dns_message_get_domain_internal (char *out, size_t outmax, char const *
if (out)
{
if (w + c > outmax) return (errno = ENAMETOOLONG, 0) ;
- byte_copy(out + w, c, s + r) ;
+ memcpy(out + w, s + r, c) ;
}
w += c ; r += c ; if (!hasjumped) *pos += c ;
if (c == 1) break ;
diff --git a/src/libs6dns/s6dns_message_get_mx.c b/src/libs6dns/s6dns_message_get_mx.c
index 6bca509..049999e 100644
--- a/src/libs6dns/s6dns_message_get_mx.c
+++ b/src/libs6dns/s6dns_message_get_mx.c
@@ -2,7 +2,7 @@
#include <errno.h>
#include <skalibs/error.h>
-#include <skalibs/uint16.h>
+#include <skalibs/types.h>
#include <s6-dns/s6dns-domain.h>
#include <s6-dns/s6dns-message.h>
diff --git a/src/libs6dns/s6dns_message_get_soa.c b/src/libs6dns/s6dns_message_get_soa.c
index c766231..5ba1239 100644
--- a/src/libs6dns/s6dns_message_get_soa.c
+++ b/src/libs6dns/s6dns_message_get_soa.c
@@ -2,7 +2,7 @@
#include <errno.h>
#include <skalibs/error.h>
-#include <skalibs/uint32.h>
+#include <skalibs/types.h>
#include <s6-dns/s6dns-message.h>
int s6dns_message_get_soa (s6dns_message_rr_soa_t *soa, char const *packet, unsigned int packetlen, unsigned int *pos)
diff --git a/src/libs6dns/s6dns_message_get_srv.c b/src/libs6dns/s6dns_message_get_srv.c
index 13ecf13..ff11b96 100644
--- a/src/libs6dns/s6dns_message_get_srv.c
+++ b/src/libs6dns/s6dns_message_get_srv.c
@@ -2,7 +2,7 @@
#include <errno.h>
#include <skalibs/error.h>
-#include <skalibs/uint16.h>
+#include <skalibs/types.h>
#include <s6-dns/s6dns-message.h>
int s6dns_message_get_srv (s6dns_message_rr_srv_t *srv, char const *packet, unsigned int packetlen, unsigned int *pos)
diff --git a/src/libs6dns/s6dns_message_get_string_internal.c b/src/libs6dns/s6dns_message_get_string_internal.c
index 7e4105b..9597c36 100644
--- a/src/libs6dns/s6dns_message_get_string_internal.c
+++ b/src/libs6dns/s6dns_message_get_string_internal.c
@@ -1,17 +1,16 @@
/* ISC license. */
-#include <sys/types.h>
+#include <string.h>
#include <errno.h>
#include <skalibs/error.h>
-#include <skalibs/bytestr.h>
#include "s6dns-message-internal.h"
int s6dns_message_get_string_internal (char *s, size_t max, char const *packet, unsigned int packetlen, unsigned int *pos)
{
- register unsigned char len = ((unsigned char const *)packet)[*pos] ;
+ unsigned char len = ((unsigned char const *)packet)[*pos] ;
if (*pos + len + 1 > packetlen) return (errno = EPROTO, -1) ;
if (len > max) return (errno = ENAMETOOLONG, -1) ;
- byte_copy(s, len, packet + *pos + 1) ;
+ memcpy(s, packet + *pos + 1, len) ;
*pos += len + 1 ;
- return (int)len ;
+ return len ;
}
diff --git a/src/libs6dns/s6dns_message_get_strings.c b/src/libs6dns/s6dns_message_get_strings.c
index 161b554..4627938 100644
--- a/src/libs6dns/s6dns_message_get_strings.c
+++ b/src/libs6dns/s6dns_message_get_strings.c
@@ -8,10 +8,10 @@ int s6dns_message_get_strings (char *s, unsigned int rdlength, char const *packe
unsigned int max = rdlength, len = 0 ;
while (rdlength)
{
- register unsigned int start = *pos ;
- register int r = s6dns_message_get_string_internal(s + len, max - len, packet, packetlen, pos) ;
+ unsigned int start = *pos ;
+ int r = s6dns_message_get_string_internal(s + len, max - len, packet, packetlen, pos) ;
if (r < 0) return -1 ;
len += r ; rdlength -= *pos - start ;
}
- return (int)len ;
+ return len ;
}
diff --git a/src/libs6dns/s6dns_message_header_pack.c b/src/libs6dns/s6dns_message_header_pack.c
index ff496fa..57ce350 100644
--- a/src/libs6dns/s6dns_message_header_pack.c
+++ b/src/libs6dns/s6dns_message_header_pack.c
@@ -1,6 +1,6 @@
/* ISC license. */
-#include <skalibs/uint16.h>
+#include <skalibs/types.h>
#include <s6-dns/s6dns-message.h>
void s6dns_message_header_pack (char *s, s6dns_message_header_t const *h)
diff --git a/src/libs6dns/s6dns_message_header_unpack.c b/src/libs6dns/s6dns_message_header_unpack.c
index 819b953..9d68bad 100644
--- a/src/libs6dns/s6dns_message_header_unpack.c
+++ b/src/libs6dns/s6dns_message_header_unpack.c
@@ -1,6 +1,6 @@
/* ISC license. */
-#include <skalibs/uint16.h>
+#include <skalibs/types.h>
#include <s6-dns/s6dns-message.h>
void s6dns_message_header_unpack (char const *s, s6dns_message_header_t *h)
diff --git a/src/libs6dns/s6dns_message_parse.c b/src/libs6dns/s6dns_message_parse.c
index eef9410..06b7677 100644
--- a/src/libs6dns/s6dns_message_parse.c
+++ b/src/libs6dns/s6dns_message_parse.c
@@ -28,7 +28,7 @@ int s6dns_message_parse (s6dns_message_header_t *h, char const *packet, unsigned
if (!s6dns_message_parse_getrr(&rr, packet, packetlen, &pos)) return 0 ;
if (rr.rclass == S6DNS_C_IN)
{
- register int r = (*f)(&rr, packet, packetlen, pos, section, data) ;
+ int r = (*f)(&rr, packet, packetlen, pos, section, data) ;
if (r < 1) return r ;
}
section = s6dns_message_parse_next(&counts, &rr, packet, packetlen, &pos) ;
diff --git a/src/libs6dns/s6dns_message_parse_answer_domain.c b/src/libs6dns/s6dns_message_parse_answer_domain.c
index d09abc9..3f25bd9 100644
--- a/src/libs6dns/s6dns_message_parse_answer_domain.c
+++ b/src/libs6dns/s6dns_message_parse_answer_domain.c
@@ -12,7 +12,7 @@ int s6dns_message_parse_answer_domain (s6dns_message_rr_t const *rr, char const
if ((section == 2) && (rr->rtype == data->rtype))
{
s6dns_domain_t d ;
- register unsigned int start = pos ;
+ unsigned int start = pos ;
if (!s6dns_message_get_domain(&d, packet, packetlen, &pos)) return 0 ;
if (rr->rdlength != pos - start) return (errno = EPROTO, 0) ;
if (!genalloc_append(s6dns_domain_t, &data->ds, &d)) return -1 ;
diff --git a/src/libs6dns/s6dns_message_parse_answer_hinfo.c b/src/libs6dns/s6dns_message_parse_answer_hinfo.c
index aa53601..9ee84f7 100644
--- a/src/libs6dns/s6dns_message_parse_answer_hinfo.c
+++ b/src/libs6dns/s6dns_message_parse_answer_hinfo.c
@@ -12,7 +12,7 @@ int s6dns_message_parse_answer_hinfo (s6dns_message_rr_t const *rr, char const *
{
genalloc *data = stuff ;
s6dns_message_rr_hinfo_t hinfo ;
- register unsigned int start = pos ;
+ unsigned int start = pos ;
if (!s6dns_message_get_hinfo(&hinfo, packet, packetlen, &pos)) return 0 ;
if (rr->rdlength != pos - start) return (errno = EPROTO, 0) ;
if (!genalloc_append(s6dns_message_rr_hinfo_t, data, &hinfo)) return -1 ;
diff --git a/src/libs6dns/s6dns_message_parse_answer_mx.c b/src/libs6dns/s6dns_message_parse_answer_mx.c
index 32f43c9..f9f6df8 100644
--- a/src/libs6dns/s6dns_message_parse_answer_mx.c
+++ b/src/libs6dns/s6dns_message_parse_answer_mx.c
@@ -12,7 +12,7 @@ int s6dns_message_parse_answer_mx (s6dns_message_rr_t const *rr, char const *pac
{
genalloc *data = stuff ;
s6dns_message_rr_mx_t mx ;
- register unsigned int start = pos ;
+ unsigned int start = pos ;
if (!s6dns_message_get_mx(&mx, packet, packetlen, &pos)) return 0 ;
if (rr->rdlength != pos - start) return (errno = EPROTO, 0) ;
if (!genalloc_append(s6dns_message_rr_mx_t, data, &mx)) return -1 ;
diff --git a/src/libs6dns/s6dns_message_parse_answer_soa.c b/src/libs6dns/s6dns_message_parse_answer_soa.c
index 6c7b668..d78b0b2 100644
--- a/src/libs6dns/s6dns_message_parse_answer_soa.c
+++ b/src/libs6dns/s6dns_message_parse_answer_soa.c
@@ -12,7 +12,7 @@ int s6dns_message_parse_answer_soa (s6dns_message_rr_t const *rr, char const *pa
{
genalloc *data = stuff ;
s6dns_message_rr_soa_t soa ;
- register unsigned int start = pos ;
+ unsigned int start = pos ;
if (!s6dns_message_get_soa(&soa, packet, packetlen, &pos)) return 0 ;
if (rr->rdlength != pos - start) return (errno = EPROTO, 0) ;
if (!genalloc_append(s6dns_message_rr_soa_t, data, &soa)) return -1 ;
diff --git a/src/libs6dns/s6dns_message_parse_answer_srv.c b/src/libs6dns/s6dns_message_parse_answer_srv.c
index 31be348..526d18c 100644
--- a/src/libs6dns/s6dns_message_parse_answer_srv.c
+++ b/src/libs6dns/s6dns_message_parse_answer_srv.c
@@ -12,7 +12,7 @@ int s6dns_message_parse_answer_srv (s6dns_message_rr_t const *rr, char const *pa
{
genalloc *data = stuff ;
s6dns_message_rr_srv_t srv ;
- register unsigned int start = pos ;
+ unsigned int start = pos ;
if (!s6dns_message_get_srv(&srv, packet, packetlen, &pos)) return 0 ;
if (rr->rdlength != pos - start) return (errno = EPROTO, 0) ;
if (!genalloc_append(s6dns_message_rr_srv_t, data, &srv)) return -1 ;
diff --git a/src/libs6dns/s6dns_message_parse_answer_strings.c b/src/libs6dns/s6dns_message_parse_answer_strings.c
index f5ac783..66ed36b 100644
--- a/src/libs6dns/s6dns_message_parse_answer_strings.c
+++ b/src/libs6dns/s6dns_message_parse_answer_strings.c
@@ -1,6 +1,6 @@
/* ISC license. */
-#include <sys/types.h>
+#include <string.h>
#include <errno.h>
#include <skalibs/error.h>
#include <skalibs/stralloc.h>
@@ -15,7 +15,7 @@ int s6dns_message_parse_answer_strings (s6dns_message_rr_t const *rr, char const
size_t base = data->sa.len ;
int wasnull = !data->sa.s ;
unsigned int start = pos ;
- register int r ;
+ int r ;
if (!stralloc_readyplus(&data->sa, rr->rdlength + 1)) return -1 ;
r = s6dns_message_get_strings(data->sa.s + data->sa.len, rr->rdlength, packet, packetlen, &pos) ;
if ((r < 0) || (rr->rdlength != pos - start))
diff --git a/src/libs6dns/s6dns_message_parse_getrr.c b/src/libs6dns/s6dns_message_parse_getrr.c
index 8db0c5d..86e5e59 100644
--- a/src/libs6dns/s6dns_message_parse_getrr.c
+++ b/src/libs6dns/s6dns_message_parse_getrr.c
@@ -2,8 +2,7 @@
#include <errno.h>
#include <skalibs/error.h>
-#include <skalibs/uint16.h>
-#include <skalibs/uint32.h>
+#include <skalibs/types.h>
#include <s6-dns/s6dns-message.h>
int s6dns_message_parse_getrr (s6dns_message_rr_t_ref rr, char const *packet, unsigned int packetlen, unsigned int *pos)
diff --git a/src/libs6dns/s6dns_message_parse_skipqd.c b/src/libs6dns/s6dns_message_parse_skipqd.c
index 9b8c222..95a4e40 100644
--- a/src/libs6dns/s6dns_message_parse_skipqd.c
+++ b/src/libs6dns/s6dns_message_parse_skipqd.c
@@ -7,7 +7,7 @@ unsigned int s6dns_message_parse_skipqd (s6dns_message_counts_t *counts, char co
{
for (;;)
{
- register unsigned int r = s6dns_message_counts_next(counts) ;
+ unsigned int r = s6dns_message_counts_next(counts) ;
if (r != 1) return r ;
if (!s6dns_message_get_domain_internal(0, 255, packet, packetlen, pos)) return 0 ;
*pos += 4 ;
diff --git a/src/libs6dns/s6dns_rci_init.c b/src/libs6dns/s6dns_rci_init.c
index e7d3676..4c51679 100644
--- a/src/libs6dns/s6dns_rci_init.c
+++ b/src/libs6dns/s6dns_rci_init.c
@@ -1,6 +1,7 @@
/* ISC license. */
#include <sys/types.h>
+#include <string.h>
#include <errno.h>
#include <skalibs/error.h>
#include <skalibs/bytestr.h>
@@ -15,7 +16,7 @@
static size_t readit (char const *file, char *buf, size_t max)
{
- register ssize_t r = openreadnclose(file, buf, max - 1) ;
+ ssize_t r = openreadnclose(file, buf, max - 1) ;
if (r < 0)
{
if (errno != ENOENT) return 0 ;
@@ -28,7 +29,7 @@ static size_t readit (char const *file, char *buf, size_t max)
static inline int s6dns_rci_init_servers (s6dns_rci_t *rci, char const *file, char *tmp, size_t max, size_t *size)
{
ip46_t tmplist[S6DNS_MAX_SERVERS] ;
- unsigned int num = 0 ;
+ size_t num = 0 ;
char const *x = env_get("DNSCACHEIP") ;
if (x) ip46_scanlist(tmplist, S6DNS_MAX_SERVERS, x, &num) ;
if (!num)
@@ -38,10 +39,10 @@ static inline int s6dns_rci_init_servers (s6dns_rci_t *rci, char const *file, ch
if (!*size) return 0 ;
while ((i < *size) && (num < S6DNS_MAX_SERVERS))
{
- register size_t j = byte_chr(tmp + i, *size - i, '\n') ;
- if ((i + j < *size) && (j > 13U) && !byte_diff("nameserver", 10, tmp + i))
+ size_t j = byte_chr(tmp + i, *size - i, '\n') ;
+ if ((i + j < *size) && (j > 13U) && !memcmp("nameserver", tmp + i, 10))
{
- register size_t k = 0 ;
+ size_t k = 0 ;
while ((tmp[i+10+k] == ' ') || (tmp[i+10+k] == '\t')) k++ ;
if (k && ip46_scan(tmp+i+10+k, tmplist + num)) num++ ;
}
@@ -51,18 +52,18 @@ static inline int s6dns_rci_init_servers (s6dns_rci_t *rci, char const *file, ch
if (!num)
{
num = 1 ;
- byte_copy(tmplist[0].ip, SKALIBS_IP_SIZE, S6DNS_LOCALHOST_IP) ;
+ memcpy(tmplist[0].ip, S6DNS_LOCALHOST_IP, SKALIBS_IP_SIZE) ;
#ifdef SKALIBS_IPV6_ENABLED
tmplist[0].is6 = 1 ;
#endif
}
{
- register unsigned int i = 0 ;
- byte_zero(&rci->servers, sizeof(s6dns_ip46list_t)) ;
+ unsigned int i = 0 ;
+ memset(&rci->servers, 0, sizeof(s6dns_ip46list_t)) ;
for (; i < num ; i++)
{
- byte_copy(rci->servers.ip + SKALIBS_IP_SIZE * i, SKALIBS_IP_SIZE, tmplist[i].ip) ;
+ memcpy(rci->servers.ip + SKALIBS_IP_SIZE * i, tmplist[i].ip, SKALIBS_IP_SIZE) ;
#ifdef SKALIBS_IPV6_ENABLED
if (ip46_is6(tmplist+i)) bitarray_set(rci->servers.is6, i) ;
#endif
@@ -81,7 +82,7 @@ static inline int stringrules (stralloc *rules, char const *s, unsigned int *num
while (c)
{
c = *s++ ;
- if (byte_chr(" \t\n\r", 5, c) < 5)
+ if (memchr(" \t\n\r", 5, c))
{
if (!crunching)
{
@@ -126,12 +127,12 @@ static inline int s6dns_rci_init_rules (s6dns_rci_t_ref rci, char const *file, c
{
size_t j = byte_chr(tmp + i, *size - i, '\n') ;
if ((i + j < *size) && (j > 8U)
- && (!byte_diff("domain", 6, tmp + i) || !byte_diff("search", 6, tmp + i))
+ && (!memcmp("domain", tmp + i, 6) || !memcmp("search", tmp + i, 6))
&& ((tmp[i+6] == ' ') || (tmp[i+6] == '\t') || (tmp[i+6] == '\r')))
{
size_t k = 0 ;
int copying = 0 ;
- register int notsearching = (tmp[i] != 's') ;
+ int notsearching = (tmp[i] != 's') ;
if (!stralloc_readyplus(&rci->rules, j)) return 0 ;
for (; 6 + k < j ; k++)
{
diff --git a/src/libs6dns/s6dns_resolve_dpag.c b/src/libs6dns/s6dns_resolve_dpag.c
index 0bc5a42..3eaa959 100644
--- a/src/libs6dns/s6dns_resolve_dpag.c
+++ b/src/libs6dns/s6dns_resolve_dpag.c
@@ -11,7 +11,7 @@
int s6dns_resolve_dpag_r (genalloc *ds, char const *name, unsigned int len, uint16_t qtype, int qualif, s6dns_engine_t *dt, s6dns_rci_t const *rci, s6dns_debughook_t const *dbh, tain_t const *deadline, tain_t *stamp)
{
s6dns_dpag_t data ;
- register int r ;
+ int r ;
data.ds = *ds ;
data.rtype = qtype ;
r = s6dns_resolve_r(name, len, qtype, &s6dns_message_parse_answer_domain, &data, qualif, dt, rci, dbh, deadline, stamp) ;
diff --git a/src/libs6dns/s6dns_resolve_mpag.c b/src/libs6dns/s6dns_resolve_mpag.c
index ca0ab1a..b9d64e3 100644
--- a/src/libs6dns/s6dns_resolve_mpag.c
+++ b/src/libs6dns/s6dns_resolve_mpag.c
@@ -12,7 +12,7 @@
int s6dns_resolve_mpag_r (stralloc *sa, genalloc *offsets, char const *name, unsigned int len, uint16_t qtype, s6dns_message_rr_func_t_ref parsefunc, int qualif, s6dns_engine_t *dt, s6dns_rci_t const *rci, s6dns_debughook_t const *dbh, tain_t const *deadline, tain_t *stamp)
{
s6dns_mpag_t data ;
- register int r ;
+ int r ;
data.sa = *sa ;
data.offsets = *offsets ;
data.rtype = qtype ;
diff --git a/src/libs6dns/s6dns_resolve_name4.c b/src/libs6dns/s6dns_resolve_name4.c
index 7bb504a..4dc47ba 100644
--- a/src/libs6dns/s6dns_resolve_name4.c
+++ b/src/libs6dns/s6dns_resolve_name4.c
@@ -12,7 +12,7 @@ int s6dns_resolve_name4_r (genalloc *list, char const *ip, s6dns_engine_t *dt, s
{
s6dns_dpag_t data ;
s6dns_domain_t d ;
- register int r ;
+ int r ;
s6dns_domain_arpafromip4(&d, ip) ;
s6dns_domain_encode(&d) ;
data.ds = *list ;
diff --git a/src/libs6dns/s6dns_resolve_name6.c b/src/libs6dns/s6dns_resolve_name6.c
index 1af3945..39cbd43 100644
--- a/src/libs6dns/s6dns_resolve_name6.c
+++ b/src/libs6dns/s6dns_resolve_name6.c
@@ -13,7 +13,7 @@ int s6dns_resolve_name6_r (genalloc *list, char const *ip, s6dns_engine_t *dt, s
{
s6dns_dpag_t data ;
s6dns_domain_t d ;
- register int r ;
+ int r ;
s6dns_domain_arpafromip6(&d, ip, 128) ;
s6dns_domain_encode(&d) ;
data.ds = *list ;
diff --git a/src/libs6dns/s6dns_resolve_parse.c b/src/libs6dns/s6dns_resolve_parse.c
index b2e4974..2abb237 100644
--- a/src/libs6dns/s6dns_resolve_parse.c
+++ b/src/libs6dns/s6dns_resolve_parse.c
@@ -10,7 +10,7 @@
int s6dns_resolve_parse_r (s6dns_domain_t const *d, uint16_t qtype, s6dns_message_rr_func_t_ref parsefunc, void *data, s6dns_engine_t *dt, s6dns_ip46list_t const *servers, s6dns_debughook_t const *dbh, tain_t const *deadline, tain_t *stamp)
{
- register int r ;
+ int r ;
if (!s6dns_resolve_core_r(d, qtype, dt, servers, dbh, deadline, stamp)) return -1 ;
{
s6dns_message_header_t h ;
diff --git a/src/libs6dns/s6dns_resolven_loop.c b/src/libs6dns/s6dns_resolven_loop.c
index 6e0c3b4..9fefbb6 100644
--- a/src/libs6dns/s6dns_resolven_loop.c
+++ b/src/libs6dns/s6dns_resolven_loop.c
@@ -50,5 +50,5 @@ int s6dns_resolven_loop (s6dns_engine_t *dt, unsigned int n, unsigned int or, ta
}
}
}
- return or ? (errno = ENOENT, -1) : (int)count ;
+ return or ? (errno = ENOENT, -1) : count ;
}
diff --git a/src/libs6dns/s6dns_resolven_parse.c b/src/libs6dns/s6dns_resolven_parse.c
index 78289bc..a53f605 100644
--- a/src/libs6dns/s6dns_resolven_parse.c
+++ b/src/libs6dns/s6dns_resolven_parse.c
@@ -11,7 +11,7 @@
int s6dns_resolven_parse_r (s6dns_resolve_t *list, unsigned int n, s6dns_ip46list_t const *servers, s6dns_debughook_t const *dbh, tain_t const *deadline, tain_t *stamp)
{
s6dns_engine_t dtl[n] ;
- register unsigned int i = 0 ;
+ unsigned int i = 0 ;
for (; i < n ; i++) list[i].status = ECONNABORTED ;
for (i = 0 ; i < n ; i++)
{
@@ -33,7 +33,7 @@ int s6dns_resolven_parse_r (s6dns_resolve_t *list, unsigned int n, s6dns_ip46lis
else
{
s6dns_message_header_t h ;
- register int r = s6dns_message_parse(&h, s6dns_engine_packet(dtl + i), s6dns_engine_packetlen(dtl + i), list[i].parsefunc, list[i].data) ;
+ int r = s6dns_message_parse(&h, s6dns_engine_packet(dtl + i), s6dns_engine_packetlen(dtl + i), list[i].parsefunc, list[i].data) ;
if (r < 0) goto err ;
list[i].status = r ? 0 : errno ;
}
diff --git a/src/libs6dns/s6dns_resolvenoq_aaaaa.c b/src/libs6dns/s6dns_resolvenoq_aaaaa.c
index d10b20b..295be1b 100644
--- a/src/libs6dns/s6dns_resolvenoq_aaaaa.c
+++ b/src/libs6dns/s6dns_resolvenoq_aaaaa.c
@@ -38,7 +38,7 @@ int s6dns_resolvenoq_aaaaa_r (genalloc *ips, char const *name, unsigned int len,
{
int e = (!!sa[0].len << 1) | !!sa[1].len ;
size_t n = genalloc_len(ip46_t, ips) ;
- register size_t i = 0 ;
+ size_t i = 0 ;
for (; i < (sa[0].len >> 4) ; i++)
ip46_from_ip6(genalloc_s(ip46_t, ips) + n++, sa[0].s + (i << 4)) ;
for (i = 0 ; i < (sa[1].len >> 2) ; i++)
diff --git a/src/libs6dns/s6dns_resolveq.c b/src/libs6dns/s6dns_resolveq.c
index 7fad70f..eeb7335 100644
--- a/src/libs6dns/s6dns_resolveq.c
+++ b/src/libs6dns/s6dns_resolveq.c
@@ -16,7 +16,7 @@ int s6dns_resolveq_r (char const *name, unsigned int len, uint16_t qtype, s6dns_
unsigned int best = 0 ;
unsigned int n ;
int e = 0 ;
- register unsigned int i = 0 ;
+ unsigned int i = 0 ;
{
s6dns_domain_t domains[rci->rulesnum] ;
n = s6dns_domain_fromstring_qualify_encode(domains, name, len, rci->rules.s, rci->rulesnum) ;
@@ -47,14 +47,14 @@ int s6dns_resolveq_r (char const *name, unsigned int len, uint16_t qtype, s6dns_
for (;;)
{
- register int k = s6dns_resolven_loop(dtl, n, 1, deadline, stamp) ;
+ int k = s6dns_resolven_loop(dtl, n, 1, deadline, stamp) ;
if (k < 0) goto err ;
if ((unsigned int)k == best)
{
for (;; best++)
{
s6dns_message_header_t h ;
- register int r ;
+ int r ;
if (best >= n) goto notfound ;
if (error_isagain(dtl[best].status)) break ;
if (dtl[best].status) { errno = dtl[best].status ; goto err ; }
diff --git a/src/libs6dns/s6dns_resolveq_aaaaa.c b/src/libs6dns/s6dns_resolveq_aaaaa.c
index cbc853f..df65edf 100644
--- a/src/libs6dns/s6dns_resolveq_aaaaa.c
+++ b/src/libs6dns/s6dns_resolveq_aaaaa.c
@@ -20,7 +20,7 @@ int s6dns_resolveq_aaaaa_r (genalloc *ips, char const *name, unsigned int len, s
unsigned int best = 0 ;
unsigned int n ;
int e = 0 ;
- register unsigned int i = 0 ;
+ unsigned int i = 0 ;
{
s6dns_domain_t domains[rci->rulesnum] ;
n = s6dns_domain_fromstring_qualify_encode(domains, name, len, rci->rules.s, rci->rulesnum) ;
@@ -44,14 +44,14 @@ int s6dns_resolveq_aaaaa_r (genalloc *ips, char const *name, unsigned int len, s
for (;;)
{
- register int k = s6dns_resolven_loop(dtl, n << 1, 1, deadline, stamp) ;
+ int k = s6dns_resolven_loop(dtl, n << 1, 1, deadline, stamp) ;
if (k < 0) goto err ;
if ((unsigned int)k == best)
{
for (;; best++)
{
s6dns_message_header_t h ;
- register int r ;
+ int r ;
if (best >= n << 1) goto notfound ;
if (error_isagain(dtl[best].status)) break ;
if (dtl[best].status) { errno = dtl[best].status ; goto err ; }
@@ -75,9 +75,9 @@ int s6dns_resolveq_aaaaa_r (genalloc *ips, char const *name, unsigned int len, s
found:
s6dns_engine_freen(dtl, n<<1) ;
{
- register size_t len = data.len >> ((best & 1) ? 2 : 4) ;
- register size_t i = 0 ;
- register size_t base = genalloc_len(ip46_t, ips) ;
+ size_t len = data.len >> ((best & 1) ? 2 : 4) ;
+ size_t i = 0 ;
+ size_t base = genalloc_len(ip46_t, ips) ;
if (!genalloc_readyplus(ip46_t, ips, len)) return -1 ;
for (; i < len ; i++)
ip46_from_ip(genalloc_s(ip46_t, ips) + base + i, data.s + (i << ((best & 1) ? 2 : 4)), !(best & 1)) ;
diff --git a/src/skadns/skadns_cancel.c b/src/skadns/skadns_cancel.c
index a9673ed..3595585 100644
--- a/src/skadns/skadns_cancel.c
+++ b/src/skadns/skadns_cancel.c
@@ -1,13 +1,13 @@
/* ISC license. */
-/* OpenBSD sucks */
+/* OpenBSD sucks. In other news, the sky is blue. */
#ifndef _BSD_SOURCE
#define _BSD_SOURCE
#endif
#include <stdint.h>
#include <errno.h>
-#include <skalibs/uint16.h>
+#include <skalibs/types.h>
#include <skalibs/error.h>
#include <skalibs/tai.h>
#include <skalibs/gensetdyn.h>
@@ -18,7 +18,7 @@ int skadns_cancel (skadns_t *a, uint16_t id, tain_t const *deadline, tain_t *sta
{
char pack[3] = "--q" ;
char err ;
- register skadnsanswer_t *p = GENSETDYN_P(skadnsanswer_t, &a->q, id) ;
+ skadnsanswer_t *p = GENSETDYN_P(skadnsanswer_t, &a->q, id) ;
if (!error_isagain(p->status)) return skadns_release(a, id) ;
uint16_pack_big(pack, id) ;
if (!skaclient_send(&a->connection, pack, 3, &skaclient_default_cb, &err, deadline, stamp)) return 0 ;
diff --git a/src/skadns/skadns_end.c b/src/skadns/skadns_end.c
index e6e8045..252e959 100644
--- a/src/skadns/skadns_end.c
+++ b/src/skadns/skadns_end.c
@@ -9,7 +9,7 @@
static int skadnsanswer_free (char *p, void *stuff)
{
- register skadnsanswer_t *q = (skadnsanswer_t_ref)p ;
+ skadnsanswer_t *q = (skadnsanswer_t_ref)p ;
alloc_free(&q->data) ;
(void)stuff ;
return 1 ;
diff --git a/src/skadns/skadns_packet.c b/src/skadns/skadns_packet.c
index 8ef8f1d..c77bb04 100644
--- a/src/skadns/skadns_packet.c
+++ b/src/skadns/skadns_packet.c
@@ -7,7 +7,7 @@
char const *skadns_packet (skadns_t const *a, uint16_t id)
{
- register skadnsanswer_t *p = GENSETDYN_P(skadnsanswer_t, &a->q, id) ;
+ skadnsanswer_t *p = GENSETDYN_P(skadnsanswer_t, &a->q, id) ;
switch (p->status)
{
case 0 : return (char const *)p->data ;
diff --git a/src/skadns/skadns_packetlen.c b/src/skadns/skadns_packetlen.c
index f69e43f..77e3ba1 100644
--- a/src/skadns/skadns_packetlen.c
+++ b/src/skadns/skadns_packetlen.c
@@ -7,7 +7,7 @@
int skadns_packetlen (skadns_t const *a, uint16_t id)
{
- register skadnsanswer_t *p = GENSETDYN_P(skadnsanswer_t, &a->q, id) ;
+ skadnsanswer_t *p = GENSETDYN_P(skadnsanswer_t, &a->q, id) ;
switch (p->status)
{
case 0 : return p->len ;
diff --git a/src/skadns/skadns_release.c b/src/skadns/skadns_release.c
index 3ce2fc3..f563dbe 100644
--- a/src/skadns/skadns_release.c
+++ b/src/skadns/skadns_release.c
@@ -1,6 +1,6 @@
/* ISC license. */
-/* OpenBSD sucks */
+/* OpenBSD sucks. More news at 11. */
#ifndef _BSD_SOURCE
#define _BSD_SOURCE
#endif
@@ -13,7 +13,7 @@
int skadns_release (skadns_t *a, uint16_t id)
{
- register skadnsanswer_t *p = GENSETDYN_P(skadnsanswer_t, &a->q, id) ;
+ skadnsanswer_t *p = GENSETDYN_P(skadnsanswer_t, &a->q, id) ;
switch (p->status)
{
case 0 :
diff --git a/src/skadns/skadns_send.c b/src/skadns/skadns_send.c
index f485c92..35177c2 100644
--- a/src/skadns/skadns_send.c
+++ b/src/skadns/skadns_send.c
@@ -1,10 +1,10 @@
/* ISC license. */
+#include <sys/uio.h>
+#include <string.h>
#include <stdint.h>
#include <errno.h>
-#include <skalibs/uint16.h>
-#include <skalibs/bytestr.h>
-#include <skalibs/siovec.h>
+#include <skalibs/types.h>
#include <skalibs/tai.h>
#include <skalibs/stralloc.h>
#include <skalibs/gensetdyn.h>
@@ -19,14 +19,19 @@ int skadns_send (skadns_t *a, uint16_t *u, s6dns_domain_t const *d, uint16_t qty
unsigned int i ;
char tmp[17] = "--Q" ;
char err ;
- siovec_t v[2] = { { .s = tmp, .len = 17 }, { .s = (char *)d->s, .len = d->len } } ;
+ struct iovec v[2] = { { .iov_base = tmp, .iov_len = 17 }, { .iov_base = (void *)d->s, .iov_len = d->len } } ;
if (!gensetdyn_new(&a->q, &i)) return 0 ;
+ if (i > UINT16_MAX)
+ {
+ gensetdyn_delete(&a->q, i) ;
+ return (errno = EMFILE, 0) ;
+ }
uint16_pack_big(tmp, (uint16_t)i) ;
uint16_pack_big(tmp + 3, qtype) ;
- if (limit) tain_pack(tmp + 5, limit) ; else byte_zero(tmp + 5, 12) ;
+ if (limit) tain_pack(tmp + 5, limit) ; else memset(tmp + 5, 0, 12) ;
if (!skaclient_sendv(&a->connection, v, 2, &skaclient_default_cb, &err, deadline, stamp))
{
- register int e = errno ;
+ int e = errno ;
gensetdyn_delete(&a->q, i) ;
errno = e ;
return 0 ;
diff --git a/src/skadns/skadns_update.c b/src/skadns/skadns_update.c
index 73edba2..24b1e2e 100644
--- a/src/skadns/skadns_update.c
+++ b/src/skadns/skadns_update.c
@@ -1,15 +1,16 @@
/* ISC license. */
-/* OpenBSD sucks */
+/* Hey, OpenBSD, are you aware ECANCELED is POSIX? */
#ifndef _BSD_SOURCE
#define _BSD_SOURCE
#endif
+#include <string.h>
+#include <stdint.h>
#include <errno.h>
#include <skalibs/error.h>
-#include <skalibs/uint16.h>
+#include <skalibs/types.h>
#include <skalibs/alloc.h>
-#include <skalibs/bytestr.h>
#include <skalibs/genalloc.h>
#include <skalibs/gensetdyn.h>
#include <skalibs/unixmessage.h>
@@ -20,7 +21,7 @@ static int msghandler (unixmessage_t const *m, void *context)
{
skadns_t *a = (skadns_t *)context ;
skadnsanswer_t *p ;
- uint16 id ;
+ uint16_t id ;
if (m->len < 3 || m->nfds) return (errno = EPROTO, 0) ;
uint16_unpack_big(m->s, &id) ;
p = GENSETDYN_P(skadnsanswer_t, &a->q, id) ;
@@ -30,21 +31,21 @@ static int msghandler (unixmessage_t const *m, void *context)
return gensetdyn_delete(&a->q, id) ;
}
if (!error_isagain(p->status)) return (errno = EINVAL, 0) ;
- if (!genalloc_readyplus(uint16, &a->list, 1)) return 0 ;
+ if (!genalloc_readyplus(uint16_t, &a->list, 1)) return 0 ;
if (!m->s[2])
{
p->data = alloc(m->len-3) ;
if (!p->data) return 0 ;
- byte_copy(p->data, m->len-3, m->s+3) ;
+ memcpy(p->data, m->s+3, m->len-3) ;
p->len = m->len-3 ;
}
p->status = m->s[2] ;
- genalloc_append(uint16, &a->list, &id) ;
+ genalloc_append(uint16_t, &a->list, &id) ;
return 1 ;
}
int skadns_update (skadns_t *a)
{
- genalloc_setlen(uint16, &a->list, 0) ;
+ genalloc_setlen(uint16_t, &a->list, 0) ;
return skaclient_update(&a->connection, &msghandler, a) ;
}
diff --git a/src/skadns/skadnsd.c b/src/skadns/skadnsd.c
index 2682ace..b1b0687 100644
--- a/src/skadns/skadnsd.c
+++ b/src/skadns/skadnsd.c
@@ -1,9 +1,11 @@
/* ISC license. */
+#include <sys/uio.h>
+#include <string.h>
#include <stdint.h>
#include <errno.h>
#include <signal.h>
-#include <skalibs/uint16.h>
+#include <skalibs/types.h>
#include <skalibs/error.h>
#include <skalibs/strerr2.h>
#include <skalibs/sig.h>
@@ -72,7 +74,7 @@ static int parse_protocol (unixmessage_t const *m, void *context)
break ;
}
uint16_unpack_big(m->s + 3, &qtype) ;
- if (byte_diff(m->s + 5, 12, "\0\0\0\0\0\0\0\0\0\0\0"))
+ if (memcmp(m->s + 5, "\0\0\0\0\0\0\0\0\0\0\0", 12))
tain_unpack(m->s + 5, &limit) ;
else tain_add_g(&limit, &tain_infinite_relative) ;
if (!s6dns_engine_init_g(&a[sp].dt, &s6dns_rci_here.servers, 1, m->s + 17, m->len - 17, qtype, &limit))
@@ -86,7 +88,7 @@ static int parse_protocol (unixmessage_t const *m, void *context)
}
case 'q' : /* cancel a query */
{
- register unsigned int i = 0 ;
+ unsigned int i = 0 ;
for (; i < sp ; i++) if (a[i].id == id) break ;
if (i >= sp)
{
@@ -122,14 +124,14 @@ int main (void)
}
{
static dnsio_t const zero = DNSIO_ZERO ;
- register unsigned int i = 0 ;
+ unsigned int i = 0 ;
for (; i < SKADNS_MAXCONCURRENCY ; i++) a[i] = zero ;
}
for (;;)
{
iopause_fd x[3 + sp] ;
- register int r ;
+ int r ;
x[0].fd = 0 ; x[0].events = IOPAUSE_EXCEPT | IOPAUSE_READ ;
x[1].fd = 1 ; x[1].events = IOPAUSE_EXCEPT | (unixmessage_sender_isempty(unixmessage_sender_1) ? 0 : IOPAUSE_WRITE) ;
@@ -137,10 +139,10 @@ int main (void)
x[2].events = IOPAUSE_EXCEPT | (unixmessage_sender_isempty(unixmessage_sender_x) ? 0 : IOPAUSE_WRITE) ;
{
tain_t deadline = TAIN_INFINITE ;
- register unsigned int i = 0 ;
+ unsigned int i = 0 ;
for (; i < sp ; i++)
{
- register unsigned int j = 3 + i ;
+ unsigned int j = 3 + i ;
s6dns_engine_nextdeadline(&a[i].dt, &deadline) ;
x[j].fd = a[i].dt.fd ;
x[j].events = 0 ;
@@ -153,7 +155,7 @@ int main (void)
if (r < 0) strerr_diefu1sys(111, "iopause") ;
if (!r)
{
- register unsigned int i = 0 ;
+ unsigned int i = 0 ;
for (; i < sp ; i++)
if (s6dns_engine_timeout_g(&a[i].dt)) fail(i--) ;
continue ;
@@ -167,15 +169,15 @@ int main (void)
strerr_diefu1sys(111, "flush asyncout") ;
{
- register unsigned int i = 0 ;
+ unsigned int i = 0 ;
for (; i < sp ; i++) if (x[a[i].xindex].revents)
{
- register int r = s6dns_engine_event_g(&a[i].dt) ;
+ int r = s6dns_engine_event_g(&a[i].dt) ;
if (r < 0) fail(i--) ;
else if (r)
{
char pack[3] ;
- siovec_t v[2] = { { .s = pack, .len = 3 }, { .s = s6dns_engine_packet(&a[i].dt), .len = s6dns_engine_packetlen(&a[i].dt) } } ;
+ struct iovec v[2] = { { .iov_base = pack, .iov_len = 3 }, { .iov_base = s6dns_engine_packet(&a[i].dt), .iov_len = s6dns_engine_packetlen(&a[i].dt) } } ;
unixmessage_v_t mv = { .v = v, .vlen = 2, .fds = 0, .nfds = 0 } ;
uint16_pack_big(pack, a[i].id) ;
pack[2] = 0 ;