[libvirt] [PATCH] vshReadlineParse: Remove unused variable

Michal Privoznik mprivozn at redhat.com
Fri Nov 4 08:58:53 UTC 2016


After 06a7b1ff4 the @&opts_need_arg is not used anywhere. Well,
it is set but never read:

vsh.c: In function 'vshReadlineParse':
vsh.c:2658:14: warning: variable 'opts_need_arg' set but not used [-Wunused-but-set-variable]
     uint64_t opts_need_arg, opts_seen;
              ^~~~~~~~~~~~~

Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
---
 tools/vsh.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/tools/vsh.c b/tools/vsh.c
index 17199ae..f7ba070 100644
--- a/tools/vsh.c
+++ b/tools/vsh.c
@@ -2655,7 +2655,7 @@ vshReadlineParse(const char *text, int state)
     static char **completed_list;
     static unsigned int completed_list_index;
     static uint64_t const_opts_need_arg, const_opts_required, const_opts_seen;
-    uint64_t opts_need_arg, opts_seen;
+    uint64_t opts_seen;
     size_t opt_index;
     static bool cmd_exists, opts_filled, opt_exists;
     static bool non_bool_opt_exists, data_complete;
@@ -2728,7 +2728,6 @@ vshReadlineParse(const char *text, int state)
                 if (vshCmddefOptParse(cmd, &const_opts_need_arg,
                                       &const_opts_required) < 0)
                     goto error;
-                opts_need_arg = const_opts_need_arg;
                 opts_seen = const_opts_seen;
                 opts_filled = true;
             } else if (tkdata[0] == '-' && tkdata[1] == '-' &&
@@ -2793,7 +2792,6 @@ vshReadlineParse(const char *text, int state)
                     || opt->type == VSH_OT_BOOL)
                     goto error;
                 opt_exists = true;
-                opts_need_arg = const_opts_need_arg;
                 opts_seen = const_opts_seen;
             } else {
                 /* In every other case, return NULL */
-- 
2.8.4




More information about the libvir-list mailing list