diff options
author | Lennart Poettering <lennart@poettering.net> | 2015-11-25 21:56:48 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2015-11-25 22:00:07 +0100 |
commit | 422baca0f230913158078fddf884e06c8c64a316 (patch) | |
tree | f43086c3de4206488dbc7f8accaad9c629da93ca /src/shared/dns-domain.h | |
parent | 7e8131e9c6c150732503899a092206578fdc13de (diff) |
dns-domain: rework dns_label_escape() to not imply memory allocation
The new dns_label_escape() call now operates on a buffer passed in,
similar to dns_label_unescape(). This should make decoding a bit faster,
and nicer.
Diffstat (limited to 'src/shared/dns-domain.h')
-rw-r--r-- | src/shared/dns-domain.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/shared/dns-domain.h b/src/shared/dns-domain.h index 2f557d618e..99c72574db 100644 --- a/src/shared/dns-domain.h +++ b/src/shared/dns-domain.h @@ -26,11 +26,12 @@ #include "in-addr-util.h" #define DNS_LABEL_MAX 63 -#define DNS_NAME_MAX 255 +#define DNS_LABEL_ESCAPED_MAX (DNS_LABEL_MAX*4+1) int dns_label_unescape(const char **name, char *dest, size_t sz); int dns_label_unescape_suffix(const char *name, const char **label_end, char *dest, size_t sz); -int dns_label_escape(const char *p, size_t l, char **ret); +int dns_label_escape(const char *p, size_t l, char *dest, size_t sz); +int dns_label_escape_new(const char *p, size_t l, char **ret); int dns_label_apply_idna(const char *encoded, size_t encoded_size, char *decoded, size_t decoded_max); int dns_label_undo_idna(const char *encoded, size_t encoded_size, char *decoded, size_t decoded_max); |