]> git.puffer.fish Git - mirror/frr.git/commitdiff
lib: micro-op for thread_get()
authorJorge Boncompte [DTI2] <jorge@dti2.net>
Mon, 7 May 2012 16:53:13 +0000 (16:53 +0000)
committerDavid Lamparter <equinox@opensourcerouting.org>
Tue, 22 May 2012 18:35:51 +0000 (20:35 +0200)
thread_trim_head() already checks that the list is not empty.

Signed-off-by: Jorge Boncompte [DTI2] <jorge@dti2.net>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
lib/thread.c

index 784b29c67c1b5f49f87ebbd96015c9a68d4afce2..3740147e20c0c37898dbea1e37ea3f050d48e3d2 100644 (file)
@@ -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);
     }