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/UserInfoEx/src/Flags/svc_flags.cpp | 6 +++--- plugins/UserInfoEx/src/dlg_propsheet.cpp | 4 ++-- plugins/UserInfoEx/src/svc_contactinfo.cpp | 2 +- plugins/UserInfoEx/src/svc_email.cpp | 6 +++--- plugins/UserInfoEx/src/svc_gender.cpp | 2 +- plugins/UserInfoEx/src/svc_phone.cpp | 8 ++++---- 6 files changed, 14 insertions(+), 14 deletions(-) (limited to 'plugins/UserInfoEx') diff --git a/plugins/UserInfoEx/src/Flags/svc_flags.cpp b/plugins/UserInfoEx/src/Flags/svc_flags.cpp index caa4bc5a95..04f2f0154b 100644 --- a/plugins/UserInfoEx/src/Flags/svc_flags.cpp +++ b/plugins/UserInfoEx/src/Flags/svc_flags.cpp @@ -170,9 +170,9 @@ static int OnContactSettingChanged(WPARAM hContact, LPARAM lParam) /* user details update */ DBCONTACTWRITESETTING *dbcws = (DBCONTACTWRITESETTING*)lParam; - if (!mir_strcmp(dbcws->szSetting, SET_CONTACT_COUNTRY) || - !mir_strcmp(dbcws->szSetting, SET_CONTACT_ORIGIN_COUNTRY) || - !mir_strcmp(dbcws->szSetting, SET_CONTACT_COMPANY_COUNTRY)) + if (!strcmp(dbcws->szSetting, SET_CONTACT_COUNTRY) || + !strcmp(dbcws->szSetting, SET_CONTACT_ORIGIN_COUNTRY) || + !strcmp(dbcws->szSetting, SET_CONTACT_COMPANY_COUNTRY)) { /* Extra Image */ SetExtraImage(hContact); diff --git a/plugins/UserInfoEx/src/dlg_propsheet.cpp b/plugins/UserInfoEx/src/dlg_propsheet.cpp index 1354e4cc50..ad2bb1ada9 100644 --- a/plugins/UserInfoEx/src/dlg_propsheet.cpp +++ b/plugins/UserInfoEx/src/dlg_propsheet.cpp @@ -1327,13 +1327,13 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar break; } - if ( !mir_strcmp(pdbcws->szSetting, SET_CONTACT_MYHANDLE) || !mir_strcmp(pdbcws->szSetting, SET_CONTACT_NICK)) { + if ( !strcmp(pdbcws->szSetting, SET_CONTACT_MYHANDLE) || !strcmp(pdbcws->szSetting, SET_CONTACT_NICK)) { // force the update of all propertysheetpages DlgProc(hDlg, PSM_FORCECHANGED, NULL, NULL); // update the windowtitle DlgProc(hDlg, HM_SETWINDOWTITLE, NULL, lParam); } - else if ( !mir_strcmp(pdbcws->szModule, USERINFO) || !mir_strcmp(pdbcws->szModule, pPs->pszProto) || !mir_strcmp(pdbcws->szModule, MOD_MBIRTHDAY)) { + else if ( !strcmp(pdbcws->szModule, USERINFO) || !strcmp(pdbcws->szModule, pPs->pszProto) || !strcmp(pdbcws->szModule, MOD_MBIRTHDAY)) { // force the update of all propertysheetpages DlgProc(hDlg, PSM_FORCECHANGED, NULL, NULL); } diff --git a/plugins/UserInfoEx/src/svc_contactinfo.cpp b/plugins/UserInfoEx/src/svc_contactinfo.cpp index 4d8a11bd47..f571c33dcc 100644 --- a/plugins/UserInfoEx/src/svc_contactinfo.cpp +++ b/plugins/UserInfoEx/src/svc_contactinfo.cpp @@ -700,7 +700,7 @@ static int OnSettingChanged(WPARAM hContact, LPARAM lParam) { if (hContact == NULL) { DBCONTACTWRITESETTING *pdbcws = (DBCONTACTWRITESETTING*)lParam; - if (!mir_strcmp(pdbcws->szModule, "Contact") && !mir_strcmp(pdbcws->szSetting, "NameOrder")) + if (!strcmp(pdbcws->szModule, "Contact") && !strcmp(pdbcws->szSetting, "NameOrder")) memcpy(gNameOrder, pdbcws->value.pbVal, pdbcws->value.cpbVal); } return 0; diff --git a/plugins/UserInfoEx/src/svc_email.cpp b/plugins/UserInfoEx/src/svc_email.cpp index 799b11cb8c..c642ace2f3 100644 --- a/plugins/UserInfoEx/src/svc_email.cpp +++ b/plugins/UserInfoEx/src/svc_email.cpp @@ -143,9 +143,9 @@ static int OnContactSettingChanged(MCONTACT hContact, DBCONTACTWRITESETTING* pdb { if (hContact && pdbcws && pdbcws->szSetting && ((pdbcws->value.type & DBVTF_VARIABLELENGTH) || (pdbcws->value.type == DBVT_DELETED)) && - (!mir_strncmp(pdbcws->szSetting, SET_CONTACT_EMAIL, 6) || - !mir_strncmp(pdbcws->szSetting, SET_CONTACT_COMPANY_EMAIL, 13) || - !mir_strncmp(pdbcws->szSetting, "mye-mail0", 9))) + (!strncmp(pdbcws->szSetting, SET_CONTACT_EMAIL, 6) || + !strncmp(pdbcws->szSetting, SET_CONTACT_COMPANY_EMAIL, 13) || + !strncmp(pdbcws->szSetting, "mye-mail0", 9))) { OnCListApplyIcons(hContact, 0); } diff --git a/plugins/UserInfoEx/src/svc_gender.cpp b/plugins/UserInfoEx/src/svc_gender.cpp index 50c400fa0c..637590abd3 100644 --- a/plugins/UserInfoEx/src/svc_gender.cpp +++ b/plugins/UserInfoEx/src/svc_gender.cpp @@ -92,7 +92,7 @@ static int OnCListApplyIcons(MCONTACT hContact, LPARAM) static int OnContactSettingChanged(MCONTACT hContact, DBCONTACTWRITESETTING* pdbcws) { - if (hContact && pdbcws && (pdbcws->value.type <= DBVT_BYTE) && !mir_strcmp(pdbcws->szSetting, SET_CONTACT_GENDER)) + if (hContact && pdbcws && (pdbcws->value.type <= DBVT_BYTE) && !strcmp(pdbcws->szSetting, SET_CONTACT_GENDER)) OnCListApplyIcons(hContact, 0); return 0; diff --git a/plugins/UserInfoEx/src/svc_phone.cpp b/plugins/UserInfoEx/src/svc_phone.cpp index 587ddc483d..a45f8b36e3 100644 --- a/plugins/UserInfoEx/src/svc_phone.cpp +++ b/plugins/UserInfoEx/src/svc_phone.cpp @@ -109,10 +109,10 @@ static int OnContactSettingChanged(MCONTACT hContact, DBCONTACTWRITESETTING* pdb { if (hContact && pdbcws && pdbcws->szSetting && ((pdbcws->value.type & DBVTF_VARIABLELENGTH) || (pdbcws->value.type == DBVT_DELETED)) && - (!mir_strcmp(pdbcws->szSetting, SET_CONTACT_PHONE) || - !mir_strcmp(pdbcws->szSetting, SET_CONTACT_CELLULAR) || - !mir_strcmp(pdbcws->szSetting, SET_CONTACT_COMPANY_PHONE) || - !mir_strcmp(pdbcws->szSetting, SET_CONTACT_COMPANY_CELLULAR) || + (!strcmp(pdbcws->szSetting, SET_CONTACT_PHONE) || + !strcmp(pdbcws->szSetting, SET_CONTACT_CELLULAR) || + !strcmp(pdbcws->szSetting, SET_CONTACT_COMPANY_PHONE) || + !strcmp(pdbcws->szSetting, SET_CONTACT_COMPANY_CELLULAR) || !strncmp(pdbcws->szSetting, "MyPhone0", 8))) OnCListApplyIcons(hContact, 0); -- cgit v1.2.3