diff options
author | Carsten Haitzler <raster@rasterman.com> | 2012-05-15 07:06:12 +0000 |
---|---|---|
committer | Carsten Haitzler <raster@rasterman.com> | 2012-05-15 07:06:12 +0000 |
commit | 03b7914c401a02e86746fb2b7f2571edf6456a68 (patch) | |
tree | b81186f460e63861406bdb245592d5eac856fb45 | |
parent | 273f192d4b7a7445746200fed012025513503f06 (diff) | |
download | eet-03b7914c401a02e86746fb2b7f2571edf6456a68.tar.gz |
fix eet_dict locks and formatting.
SVN revision: 71097
-rw-r--r-- | src/lib/eet_dictionary.c | 14 |
1 files 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); |