[quagga-dev 9318] [PATCH 23/25] lib: micro-op for thread_get()

Jorge Boncompte [DTI2] jorge at dti2.net
Mon May 7 18:53:13 BST 2012


From: "Jorge Boncompte [DTI2]" <jorge at dti2.net>

thread_trim_head() already checks that the list is not empty.

Signed-off-by: Jorge Boncompte [DTI2] <jorge at dti2.net>
---
 lib/thread.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/lib/thread.c b/lib/thread.c
index 1197e77..eff0781 100644
--- a/lib/thread.c
+++ b/lib/thread.c
@@ -667,11 +667,10 @@ static struct thread *
 thread_get (struct thread_master *m, u_char type,
 	    int (*func) (struct thread *), void *arg, const char* funcname)
 {
-  struct thread *thread;
+  struct thread *thread = thread_trim_head (&m->unuse);
 
-  if (!thread_empty (&m->unuse))
+  if (thread)
     {
-      thread = thread_trim_head (&m->unuse);
       if (thread->funcname)
         XFREE(MTYPE_THREAD_FUNCNAME, thread->funcname);
     }
-- 
1.7.8.3





More information about the Quagga-dev mailing list