[libvirt] [PATCH 1/2] nwfilter: Clean up virNWFilterDetermineMissingVarsRec returns

Erik Skultety eskultet at redhat.com
Mon Oct 2 10:50:24 UTC 2017


On Fri, Sep 29, 2017 at 09:31:08AM -0400, John Ferlan wrote:
> Rather than using loop break;'s in order to force a return
> of rc = -1, let's just return -1 immediately on the various
> error paths and then return 0 on the success path.
>
> Signed-off-by: John Ferlan <jferlan at redhat.com>
> ---
>  src/nwfilter/nwfilter_gentech_driver.c | 23 ++++++++---------------
>  1 file changed, 8 insertions(+), 15 deletions(-)
>
> diff --git a/src/nwfilter/nwfilter_gentech_driver.c b/src/nwfilter/nwfilter_gentech_driver.c
> index 6758200b5..7a3d115ba 100644
> --- a/src/nwfilter/nwfilter_gentech_driver.c
> +++ b/src/nwfilter/nwfilter_gentech_driver.c
> @@ -494,7 +494,7 @@ virNWFilterDetermineMissingVarsRec(virNWFilterDefPtr filter,
>                                     virNWFilterDriverStatePtr driver)
>  {
>      virNWFilterObjPtr obj;
> -    int rc = 0;
> +    int rc;

I prefer the variables to be initialized on the stack, it prevents the
unnecessary "may be uninitialized" warnings. It's a pity the other variables
are uninitialized, but that's for a patch for another time. With this hunk
dropped:

Reviewed-by: Erik Skultety <eskultet at redhat.com>




More information about the libvir-list mailing list