From 74778b524d11ca77f06d72fbd87b036d0720646a Mon Sep 17 00:00:00 2001 From: raster Date: Tue, 15 May 2012 07:06:12 +0000 Subject: [PATCH] fix eet_dict locks and formatting. git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/eet@71097 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- src/lib/eet_dictionary.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/lib/eet_dictionary.c b/src/lib/eet_dictionary.c index f307d4d..b06ca77 100644 --- a/src/lib/eet_dictionary.c +++ b/src/lib/eet_dictionary.c @@ -64,7 +64,8 @@ _eet_dictionary_lookup(Eet_Dictionary *ed, if (ed->all[current].len == len) { if (ed->all[current].str && - (ed->all[current].str == string || strcmp(ed->all[current].str, string) == 0)) + ((ed->all[current].str == string) || + (!strcmp(ed->all[current].str, string)))) { found = EINA_TRUE; break; @@ -75,7 +76,7 @@ _eet_dictionary_lookup(Eet_Dictionary *ed, current = ed->all[current].next; } - if (current == -1 && found) + if ((current == -1) && found) return prev; return current; @@ -90,6 +91,7 @@ eet_dictionary_string_add(Eet_Dictionary *ed, int hash; int idx; int len; + int cnt; if (!ed) return -1; @@ -103,7 +105,9 @@ eet_dictionary_string_add(Eet_Dictionary *ed, if (idx != -1) { - if (ed->all[idx].str && (ed->all[idx].str == string || strcmp(ed->all[idx].str, string) == 0)) + if (ed->all[idx].str && + ((ed->all[idx].str == string) || + (!strcmp(ed->all[idx].str, string)))) { eina_lock_release(&ed->mutex); return idx; @@ -156,8 +160,10 @@ eet_dictionary_string_add(Eet_Dictionary *ed, ed->hash[hash] = ed->count; } + ed->count++; + cnt = ed->count; eina_lock_release(&ed->mutex); - return ed->count++; + return cnt; on_error: eina_lock_release(&ed->mutex); -- 2.7.4