summaryrefslogtreecommitdiff
path: root/src/libs6dns/s6dns_engine.c
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2024-07-05 09:13:04 +0000
committerLaurent Bercot <ska@appnovation.com>2024-07-05 09:13:04 +0000
commit732bd6a1f4c4e77ba152b213b5ce1f467c1fdef6 (patch)
treeb27a5ae34a18734baba2d3089b891db9602c6dd1 /src/libs6dns/s6dns_engine.c
parentea9f0d8f2853b512e841ef2d6ca2afa3792616b8 (diff)
downloads6-dns-732bd6a1f4c4e77ba152b213b5ce1f467c1fdef6.tar.xz
Remove s6dns_mininetstring, prepare for 2.7.2.3
Signed-off-by: Laurent Bercot <ska@appnovation.com>
Diffstat (limited to 'src/libs6dns/s6dns_engine.c')
-rw-r--r--src/libs6dns/s6dns_engine.c39
1 files changed, 1 insertions, 38 deletions
diff --git a/src/libs6dns/s6dns_engine.c b/src/libs6dns/s6dns_engine.c
index 7f20d73..ed5fd72 100644
--- a/src/libs6dns/s6dns_engine.c
+++ b/src/libs6dns/s6dns_engine.c
@@ -55,43 +55,6 @@ static int relevant (char const *q, unsigned int qlen, char const *ans, unsigned
return 1 ;
}
-static int s6dns_mininetstring_read (int fd, stralloc *sa, uint32_t *w)
-{
- if (!*w)
- {
- unsigned char pack[2] ;
- switch (fd_read(fd, (char *)pack, 2))
- {
- case -1 : return -1 ;
- case 0 : return 0 ;
- case 1 : *w = ((uint32_t)pack[0] << 8) | (1U << 31) ; break ;
- case 2 : *w = ((uint32_t)pack[0] << 8) | (uint32_t)pack[1] | (1U << 30) ; break ;
- default : return (errno = EDOM, -1) ;
- }
- }
- if (*w & (1U << 31))
- {
- unsigned char c ;
- switch (fd_read(fd, (char *)&c, 1))
- {
- case -1 : return -1 ;
- case 0 : return (errno = EPIPE, -1) ;
- case 1 : *w |= (uint32_t)c | (1U << 30) ; *w &= ~(1U << 31) ; break ;
- default : return (errno = EDOM, -1) ;
- }
- }
- if (*w & (1U << 30))
- {
- if (!stralloc_readyplus(sa, *w & ~(1U << 30))) return -1 ;
- *w &= ~(1U << 30) ;
- }
- {
- size_t r = allread(fd, sa->s + sa->len, *w) ;
- sa->len += r ; *w -= r ;
- }
- return *w ? -1 : 1 ;
-}
-
/* Network core functions: transport-dependent */
@@ -285,7 +248,7 @@ static int s6dns_engine_read_udp (s6dns_engine_t *dt, tain const *stamp)
static int s6dns_engine_read_tcp (s6dns_engine_t *dt, tain const *stamp)
{
- ssize_t r = sanitize_read(s6dns_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)