shared/id128-print: fix indentation, reduce variable scope

This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2023-08-29 17:06:47 +03:00
parent 782902f217
commit f1c0ad5279
+5 -7
View File
@@ -11,12 +11,10 @@
#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"