From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24299 invoked by alias); 19 Apr 2011 13:42:55 -0000 Received: (qmail 24286 invoked by uid 22791); 19 Apr 2011 13:42:54 -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.152) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 19 Apr 2011 13:42:30 +0000 Received: from md1.u-strasbg.fr (md1.u-strasbg.fr [IPv6:2001:660:2402::186]) by mailhost.u-strasbg.fr (8.14.3/jtpda-5.5pre1) with ESMTP id p3JDgR8B007623 for ; Tue, 19 Apr 2011 15:42:27 +0200 (CEST) (envelope-from pierre.muller@ics-cnrs.unistra.fr) Received: from mailserver.u-strasbg.fr (ms2.u-strasbg.fr [130.79.204.11]) by md1.u-strasbg.fr (8.14.4/jtpda-5.5pre1) with ESMTP id p3JDgRNx059820 for ; Tue, 19 Apr 2011 15:42:27 +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 p3JDgQYD078693 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO) for ; Tue, 19 Apr 2011 15:42:27 +0200 (CEST) (envelope-from pierre.muller@ics-cnrs.unistra.fr) From: "Pierre Muller" To: Subject: [RFA] ARI fix: avoid assignment in if clause in xcoffread.c Date: Tue, 19 Apr 2011 13:42:00 -0000 Message-ID: <000901cbfe97$9ed7f120$dc87d360$@muller@ics-cnrs.unistra.fr> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 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/msg00319.txt.bz2 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 == ':') + retrun NULL; + pp = (char *) strchr (name, ':'); + if (pp == NULL) would that be better? Or this the patch below OK? Pierre Muller GDB pascal language maintainer 2011-04-19 Pierre Muller * xcoffread.c (process_xcoff_symbol): ARI fix: Avoid assignment inside if clause. Index: xcoffread.c =================================================================== 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 13:18:53 -0000 @@ -1585,7 +1585,8 @@ process_xcoff_symbol (struct coff_symbol where we need to, which is not necessarily super-clean, but seems workable enough. */ - if (*name == ':' || (pp = (char *) strchr (name, ':')) == NULL) + pp = (char *) strchr (name, ':'); + if (*name == ':' || pp == NULL) return NULL; ++pp;