From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17545 invoked by alias); 19 Apr 2011 14:13:45 -0000 Received: (qmail 17533 invoked by uid 22791); 19 Apr 2011 14:13:44 -0000 X-SWARE-Spam-Status: No, hits=-1.5 required=5.0 tests=AWL,BAYES_00,MSGID_MULTIPLE_AT X-Spam-Check-By: sourceware.org Received: from mailhost.u-strasbg.fr (HELO mailhost.u-strasbg.fr) (130.79.200.153) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 19 Apr 2011 14:13:29 +0000 Received: from md2.u-strasbg.fr (md2.u-strasbg.fr [IPv6:2001:660:2402::187]) by mailhost.u-strasbg.fr (8.14.3/jtpda-5.5pre1) with ESMTP id p3JEDNb9068217 ; Tue, 19 Apr 2011 16:13:23 +0200 (CEST) (envelope-from pierre.muller@ics-cnrs.unistra.fr) Received: from mailserver.u-strasbg.fr (ms4.u-strasbg.fr [130.79.204.13]) by md2.u-strasbg.fr (8.14.4/jtpda-5.5pre1) with ESMTP id p3JEDNIZ071381 ; Tue, 19 Apr 2011 16:13:23 +0200 (CEST) (envelope-from pierre.muller@ics-cnrs.unistra.fr) Received: from E6510Muller (gw-ics.u-strasbg.fr [130.79.210.225]) (user=mullerp mech=LOGIN) by mailserver.u-strasbg.fr (8.14.4/jtpda-5.5pre1) with ESMTP id p3JEDM6U001419 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO) ; Tue, 19 Apr 2011 16:13:22 +0200 (CEST) (envelope-from pierre.muller@ics-cnrs.unistra.fr) From: "Pierre Muller" To: "'Pedro Alves'" , References: <000901cbfe97$9ed7f120$dc87d360$@muller@ics-cnrs.unistra.fr> <201104191501.53552.pedro@codesourcery.com> In-Reply-To: <201104191501.53552.pedro@codesourcery.com> Subject: RE: [RFA] ARI fix: avoid assignment in if clause in xcoffread.c Date: Tue, 19 Apr 2011 14:13:00 -0000 Message-ID: <001201cbfe9b$f124ae10$d36e0a30$@muller@ics-cnrs.unistra.fr> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2011-04/txt/msg00323.txt.bz2 > -----Message d'origine----- > De=A0: gdb-patches-owner@sourceware.org [mailto:gdb-patches- > owner@sourceware.org] De la part de Pedro Alves > Envoy=E9=A0: mardi 19 avril 2011 16:02 > =C0=A0: gdb-patches@sourceware.org > Cc=A0: Pierre Muller > Objet=A0: Re: [RFA] ARI fix: avoid assignment in if clause in xcoffread.c >=20 > On Tuesday 19 April 2011 14:42:25, Pierre Muller wrote: > > If I understand the code correctly, this patch > > should have no effect, the only thing that could have is > > an unnecessary call to strchr. > > The other alternative would be to > > do a > > + if (*name =3D=3D ':') > > + retrun NULL; > > + pp =3D (char *) strchr (name, ':'); > > + if (pp =3D=3D NULL) > > would that be better? >=20 > Yes, okay with that change. Thanks, here is what I checked in. Pierre 2011-04-19 Pierre Muller * xcoffread.c (process_xcoff_symbol): ARI fix: Avoid assignment inside if clause. Index: xcoffread.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /cvs/src/src/gdb/xcoffread.c,v retrieving revision 1.85 diff -u -p -r1.85 xcoffread.c --- xcoffread.c 4 Apr 2011 14:29:27 -0000 1.85 +++ xcoffread.c 19 Apr 2011 14:10:54 -0000 @@ -1585,7 +1585,11 @@ process_xcoff_symbol (struct coff_symbol where we need to, which is not necessarily super-clean, but seems workable enough. */ =20 - if (*name =3D=3D ':' || (pp =3D (char *) strchr (name, ':')) =3D=3D NUL= L) + if (*name =3D=3D ':') + return NULL; + + pp =3D (char *) strchr (name, ':'); + if (pp =3D=3D NULL) return NULL; =20 ++pp;