This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFA] ARI fix: avoid assignment in if clause in xcoffread.c


  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  <muller@ics.u-strasbg.fr>

	* 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;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]