summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-12-02 20:35:02 +0100
committerLennart Poettering <lennart@poettering.net>2015-12-02 20:35:08 +0100
commitc38a52dae3a2e50c3524c36801fcd6073c5a4564 (patch)
tree04be0a1bbf76fce7605e14454ba09ac8579a20b9
parentf3f4f0086ea45ce82658d5fd8a9a36f25685043f (diff)
resolved: simplify dns_packet_append_string()
It essentially does the same as dns_packet_append_raw_string(), hence make it a wrapper around it.
-rw-r--r--src/resolve/resolved-dns-packet.c17
1 files changed, 1 insertions, 16 deletions
diff --git a/src/resolve/resolved-dns-packet.c b/src/resolve/resolved-dns-packet.c
index 75ca23fd08..4f6498b28b 100644
--- a/src/resolve/resolved-dns-packet.c
+++ b/src/resolve/resolved-dns-packet.c
@@ -351,25 +351,10 @@ int dns_packet_append_uint32(DnsPacket *p, uint32_t v, size_t *start) {
}
int dns_packet_append_string(DnsPacket *p, const char *s, size_t *start) {
- void *d;
- size_t l;
- int r;
-
assert(p);
assert(s);
- l = strlen(s);
- if (l > 255)
- return -E2BIG;
-
- r = dns_packet_extend(p, 1 + l, &d, start);
- if (r < 0)
- return r;
-
- ((uint8_t*) d)[0] = (uint8_t) l;
- memcpy(((uint8_t*) d) + 1, s, l);
-
- return 0;
+ return dns_packet_append_raw_string(p, s, strlen(s), start);
}
int dns_packet_append_raw_string(DnsPacket *p, const void *s, size_t size, size_t *start) {