diff options
author | slavomir vlcek <svlc@inventati.org> | 2013-10-10 17:25:22 +0200 |
---|---|---|
committer | Allan McRae <allan@archlinux.org> | 2013-10-14 05:01:15 +0200 |
commit | e5f23e0ebb14be22623c38130e6c2b3c37954a2b (patch) | |
tree | 045ad9fae436f8290e78c2554c41407a24371ff3 | |
parent | d79872b4c71f93b225d7bc0987e33cebfe687e42 (diff) | |
download | pacman-e5f23e0ebb14be22623c38130e6c2b3c37954a2b.tar.gz pacman-e5f23e0ebb14be22623c38130e6c2b3c37954a2b.tar.xz |
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 <svlc@inventati.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
-rw-r--r-- | lib/libalpm/alpm_list.c | 10 |
1 files changed, 6 insertions, 4 deletions
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; } } |