diff options
author | Lennart Poettering <lennart@poettering.net> | 2016-01-13 20:45:20 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2016-01-13 20:45:20 +0100 |
commit | 45c4210ed606b1e3318bba7edb5c1b962764a1c2 (patch) | |
tree | 4b2726ff585175061b539d793712073397cba425 | |
parent | 34361485a8ff397be06a3875df0c5331ad45c845 (diff) |
shared: simplify string concatenation with strjoin()
-rw-r--r-- | src/shared/dns-domain.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/src/shared/dns-domain.c b/src/shared/dns-domain.c index d36eb5056f..1235ff109b 100644 --- a/src/shared/dns-domain.c +++ b/src/shared/dns-domain.c @@ -1143,17 +1143,15 @@ int dns_service_split(const char *joined, char **_name, char **_type, char **_do if (x >= 3 && srv_type_label_is_valid(c, cn)) { if (dns_service_name_label_is_valid(a, an)) { - /* OK, got <name> . <type> . <type2> . <domain> */ name = strndup(a, an); if (!name) return -ENOMEM; - type = new(char, bn+1+cn+1); + type = strjoin(b, ".", c, NULL); if (!type) return -ENOMEM; - strcpy(stpcpy(stpcpy(type, b), "."), c); d = p; goto finish; @@ -1165,10 +1163,9 @@ int dns_service_split(const char *joined, char **_name, char **_type, char **_do name = NULL; - type = new(char, an+1+bn+1); + type = strjoin(a, ".", b, NULL); if (!type) return -ENOMEM; - strcpy(stpcpy(stpcpy(type, a), "."), b); d = q; goto finish; |