From baa0c8ab5a4e5dc7a94a6bb0b8be095a760f48d0 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 24 Nov 2017 14:52:14 +0300 Subject: dbeditor: - code cleaning - version bump --- plugins/DbEditorPP/src/modsettingenum.cpp | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) (limited to 'plugins/DbEditorPP/src/modsettingenum.cpp') diff --git a/plugins/DbEditorPP/src/modsettingenum.cpp b/plugins/DbEditorPP/src/modsettingenum.cpp index 9e4ee6c580..e0a4d40ba1 100644 --- a/plugins/DbEditorPP/src/modsettingenum.cpp +++ b/plugins/DbEditorPP/src/modsettingenum.cpp @@ -1,17 +1,15 @@ #include "stdafx.h" - void FreeModuleSettingLL(ModuleSettingLL *msll) { if (msll == nullptr) return; ModSetLinkLinkItem *item = msll->first; - ModSetLinkLinkItem *temp; while (item) { mir_free(item->name); - temp = item; + ModSetLinkLinkItem *temp = item; item = (ModSetLinkLinkItem *)item->next; mir_free(temp); } @@ -20,7 +18,6 @@ void FreeModuleSettingLL(ModuleSettingLL *msll) msll->last = nullptr; } - int enumModulesSettingsProc(const char *setting, void *pParam) { ModuleSettingLL *msll = (ModuleSettingLL *)pParam; @@ -46,7 +43,6 @@ int enumModulesSettingsProc(const char *setting, void *pParam) return 0; } - int EnumModules(ModuleSettingLL *msll) // 1 = success, 0 = fail { msll->first = nullptr; @@ -58,13 +54,11 @@ int EnumModules(ModuleSettingLL *msll) // 1 = success, 0 = fail return 1; } - int enumSettingsProc(const char *setting, void *lParam) { return enumModulesSettingsProc(setting, lParam); } - int EnumSettings(MCONTACT hContact, const char *module, ModuleSettingLL *msll) { // enum all setting the contact has for the module @@ -77,25 +71,21 @@ int EnumSettings(MCONTACT hContact, const char *module, ModuleSettingLL *msll) return 1; } - int CheckIfModuleIsEmptyProc(const char*, void*) { return 1; } - int IsModuleEmpty(MCONTACT hContact, const char *module) { return 0 > db_enum_settings(hContact, CheckIfModuleIsEmptyProc, module); } - static int stringCompare(const char *p1, const char *p2) { return mir_strcmp(p1, p2); } - LIST m_lResidentSettings(10, stringCompare); int enumResidentProc(const char *setting, void*) @@ -104,7 +94,6 @@ int enumResidentProc(const char *setting, void*) return 0; } - int LoadResidentSettings() { if (g_db) @@ -112,16 +101,14 @@ int LoadResidentSettings() return 0; } - void FreeResidentSettings() { - for (int i = 0; i < m_lResidentSettings.getCount(); i++) { + for (int i = 0; i < m_lResidentSettings.getCount(); i++) mir_free(m_lResidentSettings[i]); - } + m_lResidentSettings.destroy(); } - int IsResidentSetting(const char *module, const char *setting) { if (!m_lResidentSettings.getCount()) return 0; @@ -134,7 +121,6 @@ int IsResidentSetting(const char *module, const char *setting) return m_lResidentSettings.getIndex(str) != -1; } - int EnumResidentSettings(const char *module, ModuleSettingLL *msll) { msll->first = nullptr; -- cgit v1.2.3