[bgpd] Minor performance improvement patch

2007-04-15 Sebastien Tandel <sebastien@tandel.be>

	* bgp_aspath.c: (aspath_as_add, aspath_segment_add) Minor performance
	  optimization: while loop should test one pointer instead of two.
diff --git a/bgpd/ChangeLog b/bgpd/ChangeLog
index 4d6f1ef..37ca2fb 100644
--- a/bgpd/ChangeLog
+++ b/bgpd/ChangeLog
@@ -1,3 +1,8 @@
+2007-04-15 Sebastien Tandel <sebastien@tandel.be>
+
+	* bgp_aspath.c: (aspath_as_add, aspath_segment_add) Minor performance
+	  optimization: while loop should test one pointer instead of two.
+
 2007-04-08 Paul Jakma <paul.jakma@sun.com>
 
 	* bgp_route.c: (general) Same bug as fixed on 2006-11-28 by ajs for
diff --git a/bgpd/bgp_aspath.c b/bgpd/bgp_aspath.c
index 327406f..1f522d7 100644
--- a/bgpd/bgp_aspath.c
+++ b/bgpd/bgp_aspath.c
@@ -1243,13 +1243,13 @@
 {
   struct assegment *seg = as->segments;
 
-  /* Last segment search procedure. */
-  while (seg && seg->next)
-    seg = seg->next;
-  
   if (!seg)
     return;
   
+  /* Last segment search procedure. */
+  while (seg->next)
+    seg = seg->next;
+
   assegment_append_asns (seg, &asno, 1);
 }
 
@@ -1260,13 +1260,14 @@
   struct assegment *seg = as->segments;
   struct assegment *new = assegment_new (type, 0);
 
-  while (seg && seg->next)
-    seg = seg->next;
-  
-  if (seg == NULL)
-    as->segments = new;
+  if (seg)
+    {
+      while (seg->next)
+	seg = seg->next;
+      seg->next = new;
+    }
   else
-    seg->next = new;
+    as->segments = new;
 }
 
 struct aspath *