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

Re: [libvirt] Dead code vs. XXX comment: remove or not?



On Fri, Sep 04, 2009 at 04:52:07PM +0200, Jim Meyering wrote:
> Daniel Veillard wrote:
> 
> > On Thu, Sep 03, 2009 at 06:28:13PM +0200, Jim Meyering wrote:
> >> clang reported that this assignment to type is a dead store,
> >> since type is never used after this point.
> >>
> >> This is xm_internal.c, line 1074:
> >>
> >>             /* XXX Forcing to pretend its a bridge */
> >>             if (type == -1) {
> >>                 type = 1;
> >>             }
> >>
> >> Normally I'd just remove the whole if block, but the XXX comment
> >> makes me think someone has plans for this code.
> >>
> >> I'll wait for a second opinion.
> >
> >   Seems to me we used to expect type would be used to keep the trace
> > of the type of the vif, but we never use that variable, only for that
> > test. I would just kill it from that block
> >
> >     list = virConfGetValue(conf, "vif");
> >     if (list && list->type == VIR_CONF_LIST) {
> >         list = list->list;
> >         while (list) {
> >             int type = -1;
> >
> >   since we never use the value anywhere !
> 
> Good.  Thanks for the reply.
> Here's the patch.
> 
> >From 7280a306ba98ea6fa3d322089c3193b114ca4da1 Mon Sep 17 00:00:00 2001
> From: Jim Meyering <meyering redhat com>
> Date: Fri, 4 Sep 2009 16:49:37 +0200
> Subject: [PATCH] xm_internal.c: remove dead stores of local, "type"
> 
> * src/xm_internal.c (xenXMDomainConfigParse): Remove declaration
> and useless containing if-block, too.
> ---
>  src/xm_internal.c |    9 +--------
>  1 files changed, 1 insertions(+), 8 deletions(-)

  Yup, ACK :-)

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel veillard com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/


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