This is the mail archive of the gdb-patches@sources.redhat.com 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]

[commit] fix reggroup_next foobar


Hello,

This fixes a breakage in my rewritten reggroup_next. It can be triggered using "maint print register-groups".

testcase to follow ...

Andrew
2003-08-05  Andrew Cagney  <cagney@redhat.com>

	* reggroups.c (reggroup_next): Check for the final entry.

Index: reggroups.c
===================================================================
RCS file: /cvs/src/src/gdb/reggroups.c,v
retrieving revision 1.6
diff -u -r1.6 reggroups.c
--- reggroups.c	4 Aug 2003 22:24:44 -0000	1.6
+++ reggroups.c	5 Aug 2003 18:08:00 -0000
@@ -132,13 +132,18 @@
   if (groups->first == NULL)
     groups = &default_groups;
 
-  /* Retun the first/next reggroup.  */
+  /* Return the first/next reggroup.  */
   if (last == NULL)
     return groups->first->group;
   for (el = groups->first; el != NULL; el = el->next)
     {
       if (el->group == last)
-	return el->next->group;
+	{
+	  if (el->next != NULL)
+	    return el->next->group;
+	  else
+	    return NULL;
+	}
     }
   return NULL;
 }

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