From e5f23e0ebb14be22623c38130e6c2b3c37954a2b Mon Sep 17 00:00:00 2001 From: slavomir vlcek Date: Thu, 10 Oct 2013 17:25:22 +0200 Subject: libalpm: move function pointer condition Function pointer gets uselessly compared for NULL in every iteration. Move the condition to do it just once. Signed-off-by: slavomir vlcek Signed-off-by: Allan McRae --- lib/libalpm/alpm_list.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'lib') diff --git a/lib/libalpm/alpm_list.c b/lib/libalpm/alpm_list.c index 59f99f9b..a3c73aa0 100644 --- a/lib/libalpm/alpm_list.c +++ b/lib/libalpm/alpm_list.c @@ -70,11 +70,13 @@ void SYMEXPORT alpm_list_free_inner(alpm_list_t *list, alpm_list_fn_free fn) { alpm_list_t *it = list; - while(it) { - if(fn && it->data) { - fn(it->data); + if(fn) { + while(it) { + if(it->data) { + fn(it->data); + } + it = it->next; } - it = it->next; } } -- cgit v1.2.3-70-g09d2