]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
resolved: add DNS_RESOURCE_KEY_TO_STRING() macro helper
authorLennart Poettering <lennart@poettering.net>
Mon, 12 Jun 2023 14:45:25 +0000 (16:45 +0200)
committerLennart Poettering <lennart@poettering.net>
Mon, 12 Jun 2023 20:21:26 +0000 (22:21 +0200)
This does the usual compound init trick to get formatted strings of
stuff.

We should probably port various pieces of code over to using this.

src/resolve/resolved-dns-rr.h

index a3fa24eaf9bcbb4584f5c7235c3456dafb9e3d8a..fd15cc343d859ef3b632c4d2bb362532746e59b3 100644 (file)
@@ -317,6 +317,9 @@ int dns_resource_key_match_soa(const DnsResourceKey *key, const DnsResourceKey *
 char* dns_resource_key_to_string(const DnsResourceKey *key, char *buf, size_t buf_size);
 ssize_t dns_resource_record_payload(DnsResourceRecord *rr, void **out);
 
+#define DNS_RESOURCE_KEY_TO_STRING(key) \
+        dns_resource_key_to_string(key, (char[DNS_RESOURCE_KEY_STRING_MAX]) {}, DNS_RESOURCE_KEY_STRING_MAX)
+
 DEFINE_TRIVIAL_CLEANUP_FUNC(DnsResourceKey*, dns_resource_key_unref);
 
 static inline bool dns_key_is_shared(const DnsResourceKey *key) {