]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
shared/id128-print: fix indentation, reduce variable scope
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sat, 26 Aug 2023 10:22:46 +0000 (12:22 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 29 Aug 2023 14:06:47 +0000 (17:06 +0300)
src/shared/id128-print.c

index f232767adf529aa02aa4bfb89322ea80232783b6..c9509b28f0f52051a94c97597e282e14dcd6baea 100644 (file)
 #include "terminal-util.h"
 
 int id128_pretty_print_sample(const char *name, sd_id128_t id) {
-       _cleanup_free_ char *man_link = NULL, *mod_link = NULL;
-        const char *on, *off;
-        unsigned i;
+        _cleanup_free_ char *man_link = NULL, *mod_link = NULL;
 
-        on = ansi_highlight();
-        off = ansi_normal();
+        const char *on = ansi_highlight(),
+                   *off = ansi_normal();
 
         if (terminal_urlify("man:systemd-id128(1)", "systemd-id128(1)", &man_link) < 0)
                 return log_oom();
@@ -34,8 +32,8 @@ int id128_pretty_print_sample(const char *name, sd_id128_t id) {
                on, SD_ID128_FORMAT_VAL(id), off,
                man_link,
                on, name);
-        for (i = 0; i < 16; i++)
-                printf("%02x%s", id.bytes[i], i != 15 ? "," : "");
+        for (size_t i = 0; i < 16; i++)
+                printf("%02x%s", id.bytes[i], i < 15 ? "," : "");
         printf(")%s\n\n", off);
 
         printf("As Python constant:\n"