diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2022-03-23 10:48:13 +0100 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2022-03-23 11:50:18 +0100 |
commit | 5980d463048f25411c55da2f6387cdc8eaeef4c8 (patch) | |
tree | e5c32417015bfd67d326d278b1cd7dac3ada39de /src/test/test-ellipsize.c | |
parent | 5b391395822575533ab0fc93485fc5554d0da099 (diff) | |
download | systemd-5980d463048f25411c55da2f6387cdc8eaeef4c8.tar.gz |
strv: declare iterator of FOREACH_STRING() in the loop
Same idea as 03677889f0ef42cdc534bf3b31265a054b20a354.
No functional change intended. The type of the iterator is generally changed to
be 'const char*' instead of 'char*'. Despite the type commonly used, modifying
the string was not allowed.
I adjusted the naming of some short variables for clarity and reduced the scope
of some variable declarations in code that was being touched anyway.
Diffstat (limited to 'src/test/test-ellipsize.c')
-rw-r--r-- | src/test/test-ellipsize.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/src/test/test-ellipsize.c b/src/test/test-ellipsize.c index b840355f5e..7317193363 100644 --- a/src/test/test-ellipsize.c +++ b/src/test/test-ellipsize.c @@ -64,18 +64,14 @@ static void test_ellipsize_mem_one(const char *s, size_t old_length, size_t new_ } TEST(ellipsize_mem) { - const char *s; - ssize_t l, k; - FOREACH_STRING(s, "_XXXXXXXXXXX_", /* ASCII */ "_aąęółśćńżźć_", /* two-byte utf-8 */ "გამარჯობა", /* multi-byte utf-8 */ "你好世界", /* wide characters */ "你გą世óoó界") /* a mix */ - - for (l = strlen(s); l >= 0; l--) - for (k = strlen(s) + 1; k >= 0; k--) + for (ssize_t l = strlen(s); l >= 0; l--) + for (ssize_t k = strlen(s) + 1; k >= 0; k--) test_ellipsize_mem_one(s, l, k); } |