Re: [PATCH] vsh: Fix warnings in command line completer

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 05.10.2016 09:26, Jiri Denemark wrote:
> 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@xxxxxxxxxx>
> ---
> 
> Notes:
>     I'm not very fond of the second hunk, but the completer is such
>     a horrible piece of code I couldn't believe it was pushed. I just
>     made the easiest fix and ran away from the code screaming.

Well, this area has always been a mess. And I think it is mostly because
of how readline API works. The completer is called multiple times and we
have to do a lot in it in order to provide all the completions.
Having said that, I'm not sure what can be done here to improve the code
apart from rewriting it completely from scratch (or switching to a
different library, e.g. libedit).

Michal

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]