From 9f800d8e21f9f22fe87d268ab777c910416b1ddd Mon Sep 17 00:00:00 2001 From: Carsten Haitzler Date: Tue, 15 May 2012 07:06:12 +0000 Subject: [PATCH] fix eet_dict locks and formatting. SVN revision: 71097 --- legacy/eet/src/lib/eet_dictionary.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/legacy/eet/src/lib/eet_dictionary.c b/legacy/eet/src/lib/eet_dictionary.c index f307d4ddbe..b06ca7736e 100644 --- a/legacy/eet/src/lib/eet_dictionary.c +++ b/legacy/eet/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);