From 2ec5040dda86f76532d48302fede21866916954a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20P=C3=B6sel?= Date: Wed, 28 Oct 2015 08:32:01 +0000 Subject: Optimize ME_DB_CONTACT_SETTINGCHANGED functions to not use mir_strcmp() but just strcmp() (and similar methods) It's not needed to user mir_* for checking null pointers when we're comparing const strings with DBCONTACTWRITESETTING values which should be always initialized correctly. Somewhere also changed strcmpi to just strcmp, because these settings are case-sensitive anyway. git-svn-id: http://svn.miranda-ng.org/main/trunk@15631 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Clist_modern/src/modern_clc.cpp | 32 +++++++++++------------ plugins/Clist_modern/src/modern_clistsettings.cpp | 26 +++++++++--------- plugins/Clist_modern/src/modern_toolbar.cpp | 10 +++---- 3 files changed, 34 insertions(+), 34 deletions(-) (limited to 'plugins/Clist_modern') diff --git a/plugins/Clist_modern/src/modern_clc.cpp b/plugins/Clist_modern/src/modern_clc.cpp index 1f2aa2393c..260b131276 100644 --- a/plugins/Clist_modern/src/modern_clc.cpp +++ b/plugins/Clist_modern/src/modern_clc.cpp @@ -128,40 +128,40 @@ static int clcHookSettingChanged(WPARAM hContact, LPARAM lParam) DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING*)lParam; if (hContact == NULL) { - if (!mir_strcmp(cws->szModule, "CListGroups")) + if (!strcmp(cws->szModule, "CListGroups")) pcli->pfnClcBroadcast(INTM_GROUPSCHANGED, hContact, lParam); - else if (!mir_strcmp(cws->szSetting, "XStatusId") || !mir_strcmp(cws->szSetting, "XStatusName")) + else if (!strcmp(cws->szSetting, "XStatusId") || !strcmp(cws->szSetting, "XStatusName")) cliCluiProtocolStatusChanged(0, cws->szModule); - else if (!mir_strcmp(cws->szModule, "CList")) { - if (!mir_strcmp(cws->szSetting, "OnTop")) + else if (!strcmp(cws->szModule, "CList")) { + if (!strcmp(cws->szSetting, "OnTop")) SetWindowPos(pcli->hwndContactList, cws->value.bVal ? HWND_TOPMOST : HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); } } else { - if (!mir_strcmp(cws->szSetting, "TickTS")) + if (!strcmp(cws->szSetting, "TickTS")) pcli->pfnClcBroadcast(INTM_STATUSCHANGED, hContact, 0); - else if (!mir_strcmp(cws->szModule, "UserInfo")) { - if (!mir_strcmp(cws->szSetting, "Timezone")) + else if (!strcmp(cws->szModule, "UserInfo")) { + if (!strcmp(cws->szSetting, "Timezone")) pcli->pfnClcBroadcast(INTM_TIMEZONECHANGED, hContact, 0); } - else if (!mir_strcmp(cws->szModule, "CList")) { - if (!mir_strcmp(cws->szSetting, "StatusMsg")) + else if (!strcmp(cws->szModule, "CList")) { + if (!strcmp(cws->szSetting, "StatusMsg")) pcli->pfnClcBroadcast(INTM_STATUSMSGCHANGED, hContact, 0); } - else if (!mir_strcmp(cws->szModule, "ContactPhoto")) { - if (!mir_strcmp(cws->szSetting, "File")) + else if (!strcmp(cws->szModule, "ContactPhoto")) { + if (!strcmp(cws->szSetting, "File")) pcli->pfnClcBroadcast(INTM_AVATARCHANGED, hContact, 0); } else { - if ((!mir_strcmp(cws->szSetting, "XStatusName") || !mir_strcmp(cws->szSetting, "XStatusMsg"))) + if ((!strcmp(cws->szSetting, "XStatusName") || !strcmp(cws->szSetting, "XStatusMsg"))) pcli->pfnClcBroadcast(INTM_STATUSMSGCHANGED, hContact, 0); - else if (!mir_strcmp(cws->szSetting, "XStatusId")) + else if (!strcmp(cws->szSetting, "XStatusId")) pcli->pfnClcBroadcast(INTM_STATUSCHANGED, hContact, 0); - else if (!mir_strcmp(cws->szSetting, "Timezone")) + else if (!strcmp(cws->szSetting, "Timezone")) pcli->pfnClcBroadcast(INTM_TIMEZONECHANGED, hContact, 0); - else if (!mir_strcmp(cws->szSetting, "ListeningTo")) + else if (!strcmp(cws->szSetting, "ListeningTo")) pcli->pfnClcBroadcast(INTM_STATUSMSGCHANGED, hContact, 0); - else if (!mir_strcmp(cws->szSetting, "Transport") || !mir_strcmp(cws->szSetting, "IsTransported")) { + else if (!strcmp(cws->szSetting, "Transport") || !strcmp(cws->szSetting, "IsTransported")) { pcli->pfnInvalidateDisplayNameCacheEntry(hContact); pcli->pfnClcBroadcast(CLM_AUTOREBUILD, hContact, 0); } diff --git a/plugins/Clist_modern/src/modern_clistsettings.cpp b/plugins/Clist_modern/src/modern_clistsettings.cpp index 28c36ab379..dc047d848e 100644 --- a/plugins/Clist_modern/src/modern_clistsettings.cpp +++ b/plugins/Clist_modern/src/modern_clistsettings.cpp @@ -397,14 +397,14 @@ int ContactSettingChanged(WPARAM hContact, LPARAM lParam) return 0; DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING*)lParam; - if (!mir_strcmp(cws->szModule, pdnce->m_cache_cszProto)) { + if (!strcmp(cws->szModule, pdnce->m_cache_cszProto)) { InvalidateDNCEbyPointer(hContact, pdnce, cws->value.type); - if (!mir_strcmp(cws->szSetting, "IsSubcontact")) + if (!strcmp(cws->szSetting, "IsSubcontact")) pcli->pfnInitAutoRebuild(pcli->hwndContactTree); - if (!mir_strcmp(cws->szSetting, "Status") || wildcmp(cws->szSetting, "Status?")) { - if (!mir_strcmp(cws->szModule, META_PROTO) && mir_strcmp(cws->szSetting, "Status")) { + if (!strcmp(cws->szSetting, "Status") || wildcmp(cws->szSetting, "Status?")) { + if (!strcmp(cws->szModule, META_PROTO) && strcmp(cws->szSetting, "Status")) { if (pcli->hwndContactTree && g_flag_bOnModulesLoadedCalled) pcli->pfnInitAutoRebuild(pcli->hwndContactTree); @@ -428,7 +428,7 @@ int ContactSettingChanged(WPARAM hContact, LPARAM lParam) pcli->pfnSortContacts(); } else { - if (!(!mir_strcmp(cws->szSetting, "LogonTS") || !mir_strcmp(cws->szSetting, "TickTS") || !mir_strcmp(cws->szSetting, "InfoTS"))) + if (!(!strcmp(cws->szSetting, "LogonTS") || !strcmp(cws->szSetting, "TickTS") || !strcmp(cws->szSetting, "InfoTS"))) pcli->pfnSortContacts(); return 0; @@ -436,18 +436,18 @@ int ContactSettingChanged(WPARAM hContact, LPARAM lParam) } } - if (!mir_strcmp(cws->szModule, "CList")) { + if (!strcmp(cws->szModule, "CList")) { //name is null or (setting is myhandle) - if (!mir_strcmp(cws->szSetting, "Rate")) + if (!strcmp(cws->szSetting, "Rate")) pcli->pfnClcBroadcast(CLM_AUTOREBUILD, 0, 0); - else if (pdnce->tszName == NULL || !mir_strcmp(cws->szSetting, "MyHandle")) + else if (pdnce->tszName == NULL || !strcmp(cws->szSetting, "MyHandle")) InvalidateDNCEbyPointer(hContact, pdnce, cws->value.type); - else if (!mir_strcmp(cws->szSetting, "Group")) + else if (!strcmp(cws->szSetting, "Group")) InvalidateDNCEbyPointer(hContact, pdnce, cws->value.type); - else if (!mir_strcmp(cws->szSetting, "Hidden")) { + else if (!strcmp(cws->szSetting, "Hidden")) { InvalidateDNCEbyPointer(hContact, pdnce, cws->value.type); if (cws->value.type == DBVT_DELETED || cws->value.bVal == 0) { char *szProto = GetContactProto(hContact); @@ -456,13 +456,13 @@ int ContactSettingChanged(WPARAM hContact, LPARAM lParam) } pcli->pfnClcBroadcast(CLM_AUTOREBUILD, 0, 0); } - else if (!mir_strcmp(cws->szSetting, "noOffline")) { + else if (!strcmp(cws->szSetting, "noOffline")) { InvalidateDNCEbyPointer(hContact, pdnce, cws->value.type); pcli->pfnClcBroadcast(CLM_AUTOREBUILD, 0, 0); } } - else if (!mir_strcmp(cws->szModule, "Protocol")) { - if (!mir_strcmp(cws->szSetting, "p")) { + else if (!strcmp(cws->szModule, "Protocol")) { + if (!strcmp(cws->szSetting, "p")) { InvalidateDNCEbyPointer(hContact, pdnce, cws->value.type); char *szProto = (cws->value.type == DBVT_DELETED) ? NULL : cws->value.pszVal; cli_ChangeContactIcon(hContact, pcli->pfnIconFromStatusMode(szProto, diff --git a/plugins/Clist_modern/src/modern_toolbar.cpp b/plugins/Clist_modern/src/modern_toolbar.cpp index 068462bc3e..7bdad76348 100644 --- a/plugins/Clist_modern/src/modern_toolbar.cpp +++ b/plugins/Clist_modern/src/modern_toolbar.cpp @@ -117,14 +117,14 @@ static int ehhToolBarSettingsChanged(WPARAM hContact, LPARAM lParam) if (hContact != NULL) return 0; - if (!mir_strcmp(cws->szModule, "CList")) { - if (!mir_strcmp(cws->szSetting, "HideOffline")) + if (!strcmp(cws->szModule, "CList")) { + if (!strcmp(cws->szSetting, "HideOffline")) SetButtonPressed(3, cws->value.bVal); - else if (!mir_strcmp(cws->szSetting, "UseGroups")) + else if (!strcmp(cws->szSetting, "UseGroups")) SetButtonPressed(6, cws->value.bVal); } - else if (!mir_strcmp(cws->szModule, "Skin")) { - if (!mir_strcmp(cws->szSetting, "UseSound")) + else if (!strcmp(cws->szModule, "Skin")) { + if (!strcmp(cws->szSetting, "UseSound")) SetButtonPressed(7, cws->value.bVal); } -- cgit v1.2.3