From 57308d4f9a9c181ec3b6231e946eba2300ee0472 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sat, 15 Mar 2014 16:10:54 +0000 Subject: database event registration's code slightly enhanced git-svn-id: http://svn.miranda-ng.org/main/trunk@8624 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- src/modules/database/dbutils.cpp | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'src/modules/database/dbutils.cpp') diff --git a/src/modules/database/dbutils.cpp b/src/modules/database/dbutils.cpp index d6bb468c29..7dacd223cd 100644 --- a/src/modules/database/dbutils.cpp +++ b/src/modules/database/dbutils.cpp @@ -42,10 +42,10 @@ static INT_PTR DbEventTypeRegister(WPARAM, LPARAM lParam) { DBEVENTTYPEDESCR *et = (DBEVENTTYPEDESCR*)lParam; if (et == NULL || et->cbSize != sizeof(DBEVENTTYPEDESCR)) - return 0; + return -1; if (eventTypes.getIndex(et) != -1) - return 0; + return -1; DBEVENTTYPEDESCR *p = (DBEVENTTYPEDESCR*)mir_calloc(sizeof(DBEVENTTYPEDESCR)); p->cbSize = sizeof(DBEVENTTYPEDESCR); @@ -78,12 +78,7 @@ static INT_PTR DbEventTypeGet(WPARAM wParam, LPARAM lParam) DBEVENTTYPEDESCR tmp; tmp.module = (char*)wParam; tmp.eventType = lParam; - - int idx; - if (!List_GetIndex((SortedList*)&eventTypes, &tmp, &idx)) - return 0; - - return (INT_PTR)eventTypes[idx]; + return (INT_PTR)eventTypes.find(&tmp); } ///////////////////////////////////////////////////////////////////////////////////////// -- cgit v1.2.3