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>
This commit is contained in:
slavomir vlcek 2013-10-10 17:25:22 +02:00 committed by Allan McRae
parent d79872b4c7
commit e5f23e0ebb
1 changed files with 6 additions and 4 deletions

View File

@ -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;
}
}