From ec7fd6f617f3c0df4aa649973e3d2fe205a7b7b0 Mon Sep 17 00:00:00 2001 From: Benjamin Reis Date: Fri, 20 Jan 2017 10:48:10 +0100 Subject: [PATCH] optimize always & ever --- coreapi/friendlist.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/coreapi/friendlist.c b/coreapi/friendlist.c index b39cecfb8..444321bdc 100644 --- a/coreapi/friendlist.c +++ b/coreapi/friendlist.c @@ -499,13 +499,21 @@ static LinphoneFriendListStatus _linphone_friend_list_add_friend(LinphoneFriendL return status; } addr = linphone_friend_get_address(lf); - bool_t present_in_map= FALSE; + bool_t present= FALSE; if (lf->refkey) { if(linphone_friend_list_find_friend_by_ref_key(list, lf->refkey)) { - present_in_map = TRUE; + present = TRUE; + } else { + present = FALSE; + } + } else { + if (bctbx_list_find(list->friends, lf) != NULL) { + present = TRUE; + } else { + present = FALSE; } } - if (present_in_map || bctbx_list_find(list->friends, lf) != NULL) { + if (present) { char *tmp = NULL; if (addr) tmp = linphone_address_as_string(addr); ms_warning("Friend %s already in list [%s], ignored.", tmp ? tmp : "unknown", list->display_name);