vsh: Fix warnings in command line completer

GCC complained that

vsh.c: In function 'vshReadlineOptionsGenerator':
vsh.c:2622:29: warning: unused variable 'opt' [-Wunused-variable]
         const vshCmdOptDef *opt = &cmd->opts[list_index];
                             ^
vsh.c: In function 'vshReadlineParse':
vsh.c:2830:44: warning: 'opt' may be used uninitialized in this function
[-Wmaybe-uninitialized]
             completed_list = opt->completer(autoCompleteOpaque,

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
This commit is contained in:
Jiri Denemark 2016-10-05 09:19:19 +02:00
parent 59539ebff3
commit 7fe613af57

View File

@ -2619,7 +2619,6 @@ vshReadlineOptionsGenerator(const char *text, int state, const vshCmdDef *cmd_pa
return NULL; return NULL;
while ((name = cmd->opts[list_index].name)) { while ((name = cmd->opts[list_index].name)) {
const vshCmdOptDef *opt = &cmd->opts[list_index];
char *res; char *res;
list_index++; list_index++;
@ -2648,7 +2647,7 @@ vshReadlineParse(const char *text, int state)
static vshCommandParser parser, sanitizer; static vshCommandParser parser, sanitizer;
vshCommandToken tk; vshCommandToken tk;
static const vshCmdDef *cmd; static const vshCmdDef *cmd;
const vshCmdOptDef *opt; const vshCmdOptDef *opt = NULL;
char *tkdata, *optstr, *const_tkdata, *completed_name; char *tkdata, *optstr, *const_tkdata, *completed_name;
char *res = NULL; char *res = NULL;
static char *ctext, *sanitized_text; static char *ctext, *sanitized_text;