[libvirt] [PATCH] remove useless code

Daniel P. Berrange berrange at redhat.com
Thu Feb 5 12:08:04 UTC 2009


On Wed, Feb 04, 2009 at 06:44:52PM +0100, Jim Meyering wrote:
> Barely worth posting for review, but who knows...
> 
> >From a7cae36a3d966e80d82859d63c60a303b63d6720 Mon Sep 17 00:00:00 2001
> From: Jim Meyering <meyering at redhat.com>
> Date: Wed, 4 Feb 2009 17:44:24 +0100
> Subject: [PATCH] remove useless code
> 
> * src/bridge.c (brAddTap): Remove redundant errno=ENOMEM assignment
> after failed strdup.
> * src/cgroup.c (virCgroupFree): Remove redundant *group=NULL assignment
> after VIR_FREE(*group).

ACK

> ---
>  src/bridge.c |    6 ++----
>  src/cgroup.c |    1 -
>  2 files changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/src/bridge.c b/src/bridge.c
> index 9c4ca74..990a567 100644
> --- a/src/bridge.c
> +++ b/src/bridge.c
> @@ -1,5 +1,5 @@
>  /*
> - * Copyright (C) 2007 Red Hat, Inc.
> + * Copyright (C) 2007, 2009 Red Hat, Inc.
>   *
>   * This library is free software; you can redistribute it and/or
>   * modify it under the terms of the GNU Lesser General Public
> @@ -539,10 +539,8 @@ brAddTap(brControl *ctl,
>              if ((errno = brSetInterfaceUp(ctl, try.ifr_name, 1)))
>                  goto error;
>              VIR_FREE(*ifname);
> -            if (!(*ifname = strdup(try.ifr_name))) {
> -                errno = ENOMEM;
> +            if (!(*ifname = strdup(try.ifr_name)))
>                  goto error;
> -            }


ACK, one day we should do the same for strdup() that we already did
for malloc() and wrap it in a way that gets us compile time checking

Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|




More information about the libvir-list mailing list