summaryrefslogtreecommitdiff
path: root/lib/thread.c
diff options
context:
space:
mode:
authorJorge Boncompte [DTI2] <jorge@dti2.net>2012-05-07 16:53:13 +0000
committerDavid Lamparter <equinox@opensourcerouting.org>2012-05-22 20:35:51 +0200
commit64018324d5e5071eea3b3f72f939d91dc7aef029 (patch)
treefaa7378fe45c6a11cf5198ba182f9bf54f3022f5 /lib/thread.c
parent41af338ecd56b9891d996f0fc850e02318b0c01a (diff)
lib: micro-op for thread_get()
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>
Diffstat (limited to 'lib/thread.c')
-rw-r--r--lib/thread.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/thread.c b/lib/thread.c
index 784b29c6..3740147e 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);
}