[patch 1/2] Prep cp_add_using_directive for patch 2/2

Jan Kratochvil jan.kratochvil@redhat.com
Fri Jun 24 20:26:00 GMT 2011


Hi,

just a code reshuffle for the second patch.

No functionality change intended.


Thanks,
Jan


gdb/
2011-06-24  Jan Kratochvil  <jan.kratochvil@redhat.com>

	Code cleanup.
	* cp-namespace.c (cp_add_using_directive): Turn positive comparison to
	negative comparisons.

--- a/gdb/cp-namespace.c
+++ b/gdb/cp-namespace.c
@@ -133,15 +133,23 @@ cp_add_using_directive (const char *dest,
 
   for (current = using_directives; current != NULL; current = current->next)
     {
-      if (strcmp (current->import_src, src) == 0
-          && strcmp (current->import_dest, dest) == 0
-          && ((alias == NULL && current->alias == NULL)
-              || (alias != NULL && current->alias != NULL
-        	  && strcmp (alias, current->alias) == 0))
-	  && ((declaration == NULL && current->declaration == NULL)
-	      || (declaration != NULL && current->declaration != NULL
-		  && strcmp (declaration, current->declaration) == 0)))
-	return;
+      if (strcmp (current->import_src, src) != 0)
+	continue;
+      if (strcmp (current->import_dest, dest) != 0)
+	continue;
+      if ((alias == NULL && current->alias != NULL)
+	  || (alias != NULL && current->alias == NULL)
+	  || (alias != NULL && current->alias != NULL
+	      && strcmp (alias, current->alias) != 0))
+	continue;
+      if ((declaration == NULL && current->declaration != NULL)
+	  || (declaration != NULL && current->declaration == NULL)
+	  || (declaration != NULL && current->declaration != NULL
+	      && strcmp (declaration, current->declaration) != 0))
+	continue;
+
+      /* Parameters exactly match CURRENT.  */
+      return;
     }
 
   new = OBSTACK_ZALLOC (obstack, struct using_direct);



More information about the Gdb-patches mailing list