diff options
author | Lennart Poettering <lennart@poettering.net> | 2024-09-13 17:43:28 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2024-09-13 18:00:38 +0200 |
commit | dc8ed83892405ee6f107f989678f1018b2649512 (patch) | |
tree | 3346ed2e8fe68fa682a0188bd5278910492223b4 /src | |
parent | core: do not fail if ignorable img.v/ vpick dir is empty (diff) | |
download | systemd-dc8ed83892405ee6f107f989678f1018b2649512.tar.xz systemd-dc8ed83892405ee6f107f989678f1018b2649512.zip |
dns-domain: follow our current variable naming style
Diffstat (limited to 'src')
-rw-r--r-- | src/shared/dns-domain.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/src/shared/dns-domain.c b/src/shared/dns-domain.c index ba24a77dad..62ec8de41d 100644 --- a/src/shared/dns-domain.c +++ b/src/shared/dns-domain.c @@ -395,9 +395,9 @@ int dns_label_undo_idna(const char *encoded, size_t encoded_size, char *decoded, } #endif -int dns_name_concat(const char *a, const char *b, DNSLabelFlags flags, char **_ret) { - _cleanup_free_ char *ret = NULL; - size_t n = 0; +int dns_name_concat(const char *a, const char *b, DNSLabelFlags flags, char **ret) { + _cleanup_free_ char *result = NULL; + size_t n_result = 0; const char *p; bool first = true; int r; @@ -428,16 +428,16 @@ int dns_name_concat(const char *a, const char *b, DNSLabelFlags flags, char **_r break; } - if (_ret) { - if (!GREEDY_REALLOC(ret, n + !first + DNS_LABEL_ESCAPED_MAX)) + if (ret) { + if (!GREEDY_REALLOC(result, n_result + !first + DNS_LABEL_ESCAPED_MAX)) return -ENOMEM; - r = dns_label_escape(label, r, ret + n + !first, DNS_LABEL_ESCAPED_MAX); + r = dns_label_escape(label, r, result + n_result + !first, DNS_LABEL_ESCAPED_MAX); if (r < 0) return r; if (!first) - ret[n] = '.'; + result[n_result] = '.'; } else { char escaped[DNS_LABEL_ESCAPED_MAX]; @@ -446,28 +446,28 @@ int dns_name_concat(const char *a, const char *b, DNSLabelFlags flags, char **_r return r; } - n += r + !first; + n_result += r + !first; first = false; } finish: - if (n > DNS_HOSTNAME_MAX) + if (n_result > DNS_HOSTNAME_MAX) return -EINVAL; - if (_ret) { - if (n == 0) { + if (ret) { + if (n_result == 0) { /* Nothing appended? If so, generate at least a single dot, to indicate the DNS root domain */ - if (!GREEDY_REALLOC(ret, 2)) + if (!GREEDY_REALLOC(result, 2)) return -ENOMEM; - ret[n++] = '.'; + result[n_result++] = '.'; } else { - if (!GREEDY_REALLOC(ret, n + 1)) + if (!GREEDY_REALLOC(result, n_result + 1)) return -ENOMEM; } - ret[n] = 0; - *_ret = TAKE_PTR(ret); + result[n_result] = 0; + *ret = TAKE_PTR(result); } return 0; |