Re: [PATCH v3 2/8] vsh: vshCmddefHelp: Drop the unnecessary 'else' branch

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

 



On Fri, Sep 16, 2016 at 12:50:39PM +0200, Erik Skultety wrote:
If the initial check is true the function immediately returns so there's no
need to enclose the code following the check within an 'else' block.
Also, by removing the 'else' block, the declarations need to be moved to
beginning of the function block to conform with our guidelines.

Signed-off-by: Erik Skultety <eskultet@xxxxxxxxxx>
---
tools/vsh.c | 222 ++++++++++++++++++++++++++++++------------------------------
1 file changed, 111 insertions(+), 111 deletions(-)

diff --git a/tools/vsh.c b/tools/vsh.c
index 3772d92..4c63bd3 100644
--- a/tools/vsh.c
+++ b/tools/vsh.c
@@ -624,131 +624,131 @@ bool
vshCmddefHelp(vshControl *ctl, const char *cmdname)
{
    const vshCmdDef *def = vshCmddefSearch(cmdname);
+    /* Don't translate desc if it is "".  */
+    const char *desc = vshCmddefGetInfo(def, "desc");
+    const char *help = _(vshCmddefGetInfo(def, "help"));

This introduces a NULL defererence if the command does not exist.

ACK with that fixed.

Jan

Attachment: signature.asc
Description: Digital signature

--
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]