diff options
author | George Hazan <george.hazan@gmail.com> | 2013-04-09 20:03:46 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-04-09 20:03:46 +0000 |
commit | bcb27264ba737778e5d3edad36088bacf74f0236 (patch) | |
tree | fd1f57744dd380b7babe312a0ab5dc60b48854f2 /plugins/DbEditorPP/src/moduletree.cpp | |
parent | 940231dc5a484b03a278900e1880aa083472b601 (diff) |
- short function names allows to write database loops in one string;
- 'continue' operator can be used then;
- multiple bugs fixed in clists;
- code becomes much more compact;
git-svn-id: http://svn.miranda-ng.org/main/trunk@4403 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/DbEditorPP/src/moduletree.cpp')
-rw-r--r-- | plugins/DbEditorPP/src/moduletree.cpp | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/plugins/DbEditorPP/src/moduletree.cpp b/plugins/DbEditorPP/src/moduletree.cpp index f1e4f348c7..6e3f8f35fd 100644 --- a/plugins/DbEditorPP/src/moduletree.cpp +++ b/plugins/DbEditorPP/src/moduletree.cpp @@ -9,7 +9,6 @@ static ModuleTreeInfoStruct settings_mtis = {CONTACT, 0}; int doContacts(HWND hwnd2Tree,HTREEITEM contactsRoot,ModuleSettingLL *modlist, HANDLE hSelectedContact, char *SelectedModule, char *SelectedSetting)
{
TVINSERTSTRUCT tvi;
- HANDLE hContact;
HTREEITEM contact;
ModuleTreeInfoStruct *lParam;
struct ModSetLinkLinkItem *module;
@@ -21,12 +20,10 @@ int doContacts(HWND hwnd2Tree,HTREEITEM contactsRoot,ModuleSettingLL *modlist, H SetWindowText(hwnd2mainWindow, Translate("Loading contacts..."));
- hContact = db_find_first();
-
tvi.hInsertAfter = TVI_SORT;
tvi.item.cChildren = 1;
- while (hContact && hwnd2mainWindow) { // break after null contact
+ for (HANDLE hContact = db_find_first(); hContact && hwnd2mainWindow; hContact = db_find_next(hContact)) {
char szProto[100];
if (DBGetContactSettingStringStatic(hContact, "Protocol", "p", szProto, SIZEOF(szProto))) {
icon = GetProtoIcon(szProto);
@@ -40,10 +37,8 @@ int doContacts(HWND hwnd2Tree,HTREEITEM contactsRoot,ModuleSettingLL *modlist, H i++;
// filter
- if ((loaded && Mode == MODE_UNLOADED) || (!loaded && Mode == MODE_LOADED)) {
- hContact = db_find_next(hContact);
+ if ((loaded && Mode == MODE_UNLOADED) || (!loaded && Mode == MODE_LOADED))
continue;
- }
// add the contact
lParam = (ModuleTreeInfoStruct *)mir_calloc(sizeof(ModuleTreeInfoStruct));
@@ -122,8 +117,6 @@ int doContacts(HWND hwnd2Tree,HTREEITEM contactsRoot,ModuleSettingLL *modlist, H hItem = findItemInTree(hwnd2Tree, hSelectedContact, SelectedModule);
}
-
- hContact = db_find_next(hContact);
}
if (hItem != -1) {
|