diff options
author | George Hazan <george.hazan@gmail.com> | 2014-09-21 20:08:49 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2014-09-21 20:08:49 +0000 |
commit | 3ac2cfcc8837dd79890c2f7ea2706b5d01ba6c82 (patch) | |
tree | d433e483a9a960001ab7c5334bc99c7bde5f1448 /src/mir_core/lists.cpp | |
parent | 4bf272b9b2f12f66ee3dcfd07f16c119901a35f9 (diff) |
ancient evil destroyed
git-svn-id: http://svn.miranda-ng.org/main/trunk@10549 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src/mir_core/lists.cpp')
-rw-r--r-- | src/mir_core/lists.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/mir_core/lists.cpp b/src/mir_core/lists.cpp index 118dc5789f..f981927cd8 100644 --- a/src/mir_core/lists.cpp +++ b/src/mir_core/lists.cpp @@ -52,11 +52,11 @@ MIR_CORE_DLL(void) List_Destroy(SortedList* p_list) MIR_CORE_DLL(void*) List_Find(SortedList* p_list, void* p_value)
{
- int index;
- if (!List_GetIndex(p_list, p_value, &index))
+ int idx;
+ if (!List_GetIndex(p_list, p_value, &idx))
return NULL;
- return p_list->items[index];
+ return p_list->items[idx];
}
#ifdef _DEBUG
@@ -193,8 +193,11 @@ MIR_CORE_DLL(int) List_InsertPtr(SortedList* list, void* p) if (p == NULL)
return -1;
- int idx = list->realCount;
- List_GetIndex(list, p, &idx);
+ int idx;
+ if (list->sortFunc == 0)
+ idx = list->realCount;
+ else
+ List_GetIndex(list, p, &idx);
return List_Insert(list, p, idx);
}
|