From 6d99149365c5b279127644bfc12e76f800c806f3 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 1 Nov 2012 12:55:27 +0000 Subject: code simplification git-svn-id: http://svn.miranda-ng.org/main/trunk@2128 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- src/modules/clist/clcitems.cpp | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) (limited to 'src/modules') diff --git a/src/modules/clist/clcitems.cpp b/src/modules/clist/clcitems.cpp index 0530f75fb8..149017d8f7 100644 --- a/src/modules/clist/clcitems.cpp +++ b/src/modules/clist/clcitems.cpp @@ -292,27 +292,19 @@ ClcGroup* fnRemoveItemFromGroup(HWND hwnd, ClcGroup *group, ClcContact *contact, group->totalMembers--; ClcCacheEntry *p = cli.pfnGetCacheEntry(contact->hContact); - if (p != NULL) { - if (p->tszGroup) mir_free(p->tszGroup); - p->tszGroup = NULL; - } + if (p != NULL) + replaceStrT(p->tszGroup, NULL); } cli.pfnFreeContact(group->cl.items[iContact]); mir_free(group->cl.items[iContact]); List_Remove((SortedList*)&group->cl, iContact); - if ((GetWindowLongPtr(hwnd, GWL_STYLE) & CLS_HIDEEMPTYGROUPS) && group->cl.count == 0) { - int i; - if (group->parent == NULL) - return group; - for (i=0; i < group->parent->cl.count; i++) + if ((GetWindowLongPtr(hwnd, GWL_STYLE) & CLS_HIDEEMPTYGROUPS) && group->cl.count == 0 && group->parent != NULL) + for (int i=0; i < group->parent->cl.count; i++) if (group->parent->cl.items[i]->type == CLCIT_GROUP && group->parent->cl.items[i]->groupId == group->groupId) - break; - if (i == group->parent->cl.count) - return group; //never happens - return cli.pfnRemoveItemFromGroup(hwnd, group->parent, group->parent->cl.items[i], 0); - } + return cli.pfnRemoveItemFromGroup(hwnd, group->parent, group->parent->cl.items[i], 0); + return group; } -- cgit v1.2.3