diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2021-05-09 21:39:34 +0900 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2021-05-12 10:09:11 +0900 |
commit | 695c5fee6d09318324347526292b142da7e449a7 (patch) | |
tree | dae4c58cc7a42518c2b992145c638c8768f034fd /src/shared/specifier.c | |
parent | 567097848c734c4843932684f6603bfc13a68b98 (diff) | |
download | systemd-695c5fee6d09318324347526292b142da7e449a7.tar.gz |
specifier: rename variable
Diffstat (limited to 'src/shared/specifier.c')
-rw-r--r-- | src/shared/specifier.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/shared/specifier.c b/src/shared/specifier.c index 09e8b2dc7d..dc86b04b83 100644 --- a/src/shared/specifier.c +++ b/src/shared/specifier.c @@ -29,9 +29,9 @@ * and "%" used for escaping. */ #define POSSIBLE_SPECIFIERS ALPHANUMERICAL "%" -int specifier_printf(const char *text, const Specifier table[], const void *userdata, char **_ret) { +int specifier_printf(const char *text, const Specifier table[], const void *userdata, char **ret) { size_t l, allocated = 0; - _cleanup_free_ char *ret = NULL; + _cleanup_free_ char *result = NULL; char *t; const char *f; bool percent = false; @@ -41,9 +41,9 @@ int specifier_printf(const char *text, const Specifier table[], const void *user assert(table); l = strlen(text); - if (!GREEDY_REALLOC(ret, allocated, l + 1)) + if (!GREEDY_REALLOC(result, allocated, l + 1)) return -ENOMEM; - t = ret; + t = result; for (f = text; *f; f++, l--) if (percent) { @@ -64,13 +64,13 @@ int specifier_printf(const char *text, const Specifier table[], const void *user if (r < 0) return r; - j = t - ret; + j = t - result; k = strlen(w); - if (!GREEDY_REALLOC(ret, allocated, j + k + l + 1)) + if (!GREEDY_REALLOC(result, allocated, j + k + l + 1)) return -ENOMEM; - memcpy(ret + j, w, k); - t = ret + j + k; + memcpy(result + j, w, k); + t = result + j + k; } else if (strchr(POSSIBLE_SPECIFIERS, *f)) /* Oops, an unknown specifier. */ return -EBADSLT; @@ -92,13 +92,13 @@ int specifier_printf(const char *text, const Specifier table[], const void *user *(t++) = 0; /* Try to deallocate unused bytes, but don't sweat it too much */ - if ((size_t)(t - ret) < allocated) { - t = realloc(ret, t - ret); + if ((size_t)(t - result) < allocated) { + t = realloc(result, t - result); if (t) - ret = t; + result = t; } - *_ret = TAKE_PTR(ret); + *ret = TAKE_PTR(result); return 0; } |