]> www.infradead.org Git - users/sagi/nvme-cli.git/commitdiff
plugin: Fix files linux kernel check patch errors and warnings
authorTokunori Ikegami <ikegami.t@gmail.com>
Sun, 28 May 2023 11:58:24 +0000 (20:58 +0900)
committerDaniel Wagner <wagi@monom.org>
Thu, 1 Jun 2023 17:45:53 +0000 (19:45 +0200)
Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
plugin.c

index 440054bcefe7be8e66671fc85774fdeac560e680..3e2b62fa7bc2b5af387f6074dddbc87daa233e78 100644 (file)
--- a/plugin.c
+++ b/plugin.c
@@ -69,9 +69,10 @@ void general_help(struct plugin *plugin)
 {
        struct program *prog = plugin->parent;
        struct plugin *extension;
-       unsigned i = 0;
-       unsigned padding = 15;
-       unsigned curr_length = 0;
+       unsigned int i = 0;
+       unsigned int padding = 15;
+       unsigned int curr_length = 0;
+
        printf("%s-%s\n", prog->name, prog->version);
 
        usage(plugin);
@@ -88,11 +89,15 @@ void general_help(struct plugin *plugin)
 
        printf("\nThe following are all implemented sub-commands:\n");
 
-       /* iterate through all commands to get maximum length */
-       /* Still need to handle the case of ultra long strings, help messages, etc */
-       for (; plugin->commands[i]; i++)
-               if (padding < (curr_length = 2 + strlen(plugin->commands[i]->name)))
+       /*
+        * iterate through all commands to get maximum length
+        * Still need to handle the case of ultra long strings, help messages, etc
+        */
+       for (; plugin->commands[i]; i++) {
+               curr_length = 2 + strlen(plugin->commands[i]->name);
+               if (padding < curr_length)
                        padding = curr_length;
+       }
 
        i = 0;
        for (; plugin->commands[i]; i++)
@@ -110,8 +115,10 @@ void general_help(struct plugin *plugin)
                printf("See '%s help <command>' for more information on a specific command\n",
                        prog->name);
 
-       /* The first plugin is the built-in. If we're not showing help for the
-        * built-in, don't show the program's other extensions */
+       /*
+        * The first plugin is the built-in. If we're not showing help for the
+        * built-in, don't show the program's other extensions
+        */
        if (plugin->name)
                return;
 
@@ -183,7 +190,7 @@ int handle_plugin(int argc, char **argv, struct plugin *plugin)
        if (plugin->name) {
                printf("ERROR: Invalid sub-command '%s' for plugin %s\n", str, plugin->name);
                return -ENOTTY;
-        }
+       }
 
        extension = plugin->next;
        while (extension) {
@@ -192,8 +199,10 @@ int handle_plugin(int argc, char **argv, struct plugin *plugin)
                extension = extension->next;
        }
 
-       /* If the command is executed with the extension name and
-        * command together ("plugin-command"), run the plug in */
+       /*
+        * If the command is executed with the extension name and
+        * command together ("plugin-command"), run the plug in
+        */
        extension = plugin->next;
        while (extension) {
                if (!strncmp(str, extension->name, strlen(extension->name))) {