]> sourceware.org Git - lvm2.git/commitdiff
command: refactor loop test for end of string
authorZdenek Kabelac <zkabelac@redhat.com>
Sat, 27 Apr 2024 11:04:25 +0000 (13:04 +0200)
committerZdenek Kabelac <zkabelac@redhat.com>
Sun, 28 Apr 2024 22:13:43 +0000 (00:13 +0200)
tools/command.c
tools/man-generator.c

index c39295a5414ec135c728a0c16c59313f60f7f365..c05852af36e038718e53eb8c96a49e5b2f061390 100644 (file)
@@ -1596,7 +1596,7 @@ static void _print_usage_description(struct command *cmd)
        unsigned di = 0;
        int bi = 0;
 
-       for (di = 0; di < strlen(desc); di++) {
+       for (di = 0; desc[di]; di++) {
                if (!strncmp(&desc[di], "DESC:", 5)) {
                        if (bi) {
                                buf[bi] = '\0';
index 03322dc4076dcb7fc444588bac2f41e5df0f87c1..a0b4dde1831da6903cb27faf6fa2dd7e724b876b 100644 (file)
@@ -993,7 +993,7 @@ static void _print_man_option_desc(struct command_name *cname, int opt_enum)
                return;
        }
 
-       for (di = 0; di < strlen(desc); di++) {
+       for (di = 0; desc[di]; di++) {
                buf[bi++] = desc[di];
 
                if (bi == DESC_LINE) {
@@ -1318,9 +1318,7 @@ static void _print_desc_man(const char *desc)
        unsigned di;
        int bi = 0;
 
-       for (di = 0; di < strlen(desc); di++) {
-               if (desc[di] == '\0')
-                       break;
+       for (di = 0; desc[di]; di++) {
                if (desc[di] == '\n')
                        continue;
 
This page took 0.038073 seconds and 5 git commands to generate.