diff options
author | David Walter Seikel | 2012-01-23 23:30:42 +1000 |
---|---|---|
committer | David Walter Seikel | 2012-01-23 23:30:42 +1000 |
commit | 825a3d837a33f226c879cd02ad15c3fba57e8b2c (patch) | |
tree | 75f57bd9c4253508d338dc79ba8e57a7abc42255 /libraries/eet/src/lib/eet_dictionary.c | |
parent | Add ability to disable the test harness, or the Lua compile test. (diff) | |
download | SledjHamr-825a3d837a33f226c879cd02ad15c3fba57e8b2c.zip SledjHamr-825a3d837a33f226c879cd02ad15c3fba57e8b2c.tar.gz SledjHamr-825a3d837a33f226c879cd02ad15c3fba57e8b2c.tar.bz2 SledjHamr-825a3d837a33f226c879cd02ad15c3fba57e8b2c.tar.xz |
Update the EFL to what I'm actually using, coz I'm using some stuff not yet released.
Diffstat (limited to '')
-rw-r--r-- | libraries/eet/src/lib/eet_dictionary.c | 55 |
1 files changed, 27 insertions, 28 deletions
diff --git a/libraries/eet/src/lib/eet_dictionary.c b/libraries/eet/src/lib/eet_dictionary.c index 60d0ec1..287860d 100644 --- a/libraries/eet/src/lib/eet_dictionary.c +++ b/libraries/eet/src/lib/eet_dictionary.c | |||
@@ -16,34 +16,33 @@ eet_dictionary_add(void) | |||
16 | { | 16 | { |
17 | Eet_Dictionary *new; | 17 | Eet_Dictionary *new; |
18 | 18 | ||
19 | new = calloc(1, sizeof (Eet_Dictionary)); | 19 | new = eet_dictionary_calloc(1); |
20 | if (!new) | 20 | if (!new) |
21 | return NULL; | 21 | return NULL; |
22 | 22 | ||
23 | memset(new->hash, -1, sizeof (int) * 256); | 23 | memset(new->hash, -1, sizeof (int) * 256); |
24 | 24 | ||
25 | return new; | 25 | return new; |
26 | } /* eet_dictionary_add */ | 26 | } |
27 | 27 | ||
28 | void | 28 | void |
29 | eet_dictionary_free(Eet_Dictionary *ed) | 29 | eet_dictionary_free(Eet_Dictionary *ed) |
30 | { | 30 | { |
31 | if (ed) | 31 | int i; |
32 | { | ||
33 | int i; | ||
34 | 32 | ||
35 | for (i = 0; i < ed->count; ++i) | 33 | if (!ed) return; |
36 | if (ed->all[i].allocated) | ||
37 | eina_stringshare_del(ed->all[i].str); | ||
38 | 34 | ||
39 | if (ed->all) | 35 | for (i = 0; i < ed->count; ++i) |
40 | free(ed->all); | 36 | if (ed->all[i].allocated) |
37 | eina_stringshare_del(ed->all[i].str); | ||
41 | 38 | ||
42 | if (ed->converts) eina_hash_free(ed->converts); | 39 | if (ed->all) |
40 | free(ed->all); | ||
43 | 41 | ||
44 | free(ed); | 42 | if (ed->converts) eina_hash_free(ed->converts); |
45 | } | 43 | |
46 | } /* eet_dictionary_free */ | 44 | eet_dictionary_mp_free(ed); |
45 | } | ||
47 | 46 | ||
48 | static int | 47 | static int |
49 | _eet_dictionary_lookup(Eet_Dictionary *ed, | 48 | _eet_dictionary_lookup(Eet_Dictionary *ed, |
@@ -77,7 +76,7 @@ _eet_dictionary_lookup(Eet_Dictionary *ed, | |||
77 | return prev; | 76 | return prev; |
78 | 77 | ||
79 | return current; | 78 | return current; |
80 | } /* _eet_dictionary_lookup */ | 79 | } |
81 | 80 | ||
82 | int | 81 | int |
83 | eet_dictionary_string_add(Eet_Dictionary *ed, | 82 | eet_dictionary_string_add(Eet_Dictionary *ed, |
@@ -110,7 +109,7 @@ eet_dictionary_string_add(Eet_Dictionary *ed, | |||
110 | 109 | ||
111 | total = ed->total + 8; | 110 | total = ed->total + 8; |
112 | 111 | ||
113 | new = realloc(ed->all, sizeof (Eet_String) * total); | 112 | new = realloc(ed->all, total * sizeof(Eet_String)); |
114 | if (!new) | 113 | if (!new) |
115 | return -1; | 114 | return -1; |
116 | 115 | ||
@@ -152,7 +151,7 @@ eet_dictionary_string_add(Eet_Dictionary *ed, | |||
152 | } | 151 | } |
153 | 152 | ||
154 | return ed->count++; | 153 | return ed->count++; |
155 | } /* eet_dictionary_string_add */ | 154 | } |
156 | 155 | ||
157 | int | 156 | int |
158 | eet_dictionary_string_get_size(const Eet_Dictionary *ed, | 157 | eet_dictionary_string_get_size(const Eet_Dictionary *ed, |
@@ -168,7 +167,7 @@ eet_dictionary_string_get_size(const Eet_Dictionary *ed, | |||
168 | return ed->all[idx].len; | 167 | return ed->all[idx].len; |
169 | 168 | ||
170 | return 0; | 169 | return 0; |
171 | } /* eet_dictionary_string_get_size */ | 170 | } |
172 | 171 | ||
173 | int | 172 | int |
174 | eet_dictionary_string_get_hash(const Eet_Dictionary *ed, | 173 | eet_dictionary_string_get_hash(const Eet_Dictionary *ed, |
@@ -184,7 +183,7 @@ eet_dictionary_string_get_hash(const Eet_Dictionary *ed, | |||
184 | return ed->all[idx].hash; | 183 | return ed->all[idx].hash; |
185 | 184 | ||
186 | return -1; | 185 | return -1; |
187 | } /* eet_dictionary_string_get_hash */ | 186 | } |
188 | 187 | ||
189 | const char * | 188 | const char * |
190 | eet_dictionary_string_get_char(const Eet_Dictionary *ed, | 189 | eet_dictionary_string_get_char(const Eet_Dictionary *ed, |
@@ -210,7 +209,7 @@ eet_dictionary_string_get_char(const Eet_Dictionary *ed, | |||
210 | } | 209 | } |
211 | 210 | ||
212 | return NULL; | 211 | return NULL; |
213 | } /* eet_dictionary_string_get_char */ | 212 | } |
214 | 213 | ||
215 | static inline Eina_Bool | 214 | static inline Eina_Bool |
216 | _eet_dictionary_string_get_me_cache(const char *s, | 215 | _eet_dictionary_string_get_me_cache(const char *s, |
@@ -227,7 +226,7 @@ _eet_dictionary_string_get_me_cache(const char *s, | |||
227 | } | 226 | } |
228 | 227 | ||
229 | return EINA_FALSE; | 228 | return EINA_FALSE; |
230 | } /* _eet_dictionary_string_get_me_cache */ | 229 | } |
231 | 230 | ||
232 | static inline Eina_Bool | 231 | static inline Eina_Bool |
233 | _eet_dictionary_string_get_float_cache(const char *s, | 232 | _eet_dictionary_string_get_float_cache(const char *s, |
@@ -248,7 +247,7 @@ _eet_dictionary_string_get_float_cache(const char *s, | |||
248 | } | 247 | } |
249 | 248 | ||
250 | return EINA_FALSE; | 249 | return EINA_FALSE; |
251 | } /* _eet_dictionary_string_get_float_cache */ | 250 | } |
252 | 251 | ||
253 | static inline Eina_Bool | 252 | static inline Eina_Bool |
254 | _eet_dictionary_string_get_double_cache(const char *s, | 253 | _eet_dictionary_string_get_double_cache(const char *s, |
@@ -269,7 +268,7 @@ _eet_dictionary_string_get_double_cache(const char *s, | |||
269 | } | 268 | } |
270 | 269 | ||
271 | return EINA_FALSE; | 270 | return EINA_FALSE; |
272 | } /* _eet_dictionary_string_get_double_cache */ | 271 | } |
273 | 272 | ||
274 | static inline Eina_Bool | 273 | static inline Eina_Bool |
275 | _eet_dictionary_test(const Eet_Dictionary *ed, | 274 | _eet_dictionary_test(const Eet_Dictionary *ed, |
@@ -289,7 +288,7 @@ _eet_dictionary_test(const Eet_Dictionary *ed, | |||
289 | return EINA_FALSE; | 288 | return EINA_FALSE; |
290 | 289 | ||
291 | return EINA_TRUE; | 290 | return EINA_TRUE; |
292 | } /* _eet_dictionary_test */ | 291 | } |
293 | 292 | ||
294 | static Eet_Convert * | 293 | static Eet_Convert * |
295 | eet_dictionary_convert_get(const Eet_Dictionary *ed, | 294 | eet_dictionary_convert_get(const Eet_Dictionary *ed, |
@@ -351,7 +350,7 @@ eet_dictionary_string_get_float(const Eet_Dictionary *ed, | |||
351 | 350 | ||
352 | *result = convert->f; | 351 | *result = convert->f; |
353 | return EINA_TRUE; | 352 | return EINA_TRUE; |
354 | } /* eet_dictionary_string_get_float */ | 353 | } |
355 | 354 | ||
356 | Eina_Bool | 355 | Eina_Bool |
357 | eet_dictionary_string_get_double(const Eet_Dictionary *ed, | 356 | eet_dictionary_string_get_double(const Eet_Dictionary *ed, |
@@ -387,7 +386,7 @@ eet_dictionary_string_get_double(const Eet_Dictionary *ed, | |||
387 | 386 | ||
388 | *result = convert->d; | 387 | *result = convert->d; |
389 | return EINA_TRUE; | 388 | return EINA_TRUE; |
390 | } /* eet_dictionary_string_get_double */ | 389 | } |
391 | 390 | ||
392 | Eina_Bool | 391 | Eina_Bool |
393 | eet_dictionary_string_get_fp(const Eet_Dictionary *ed, | 392 | eet_dictionary_string_get_fp(const Eet_Dictionary *ed, |
@@ -416,7 +415,7 @@ eet_dictionary_string_get_fp(const Eet_Dictionary *ed, | |||
416 | 415 | ||
417 | *result = convert->fp; | 416 | *result = convert->fp; |
418 | return EINA_TRUE; | 417 | return EINA_TRUE; |
419 | } /* eet_dictionary_string_get_fp */ | 418 | } |
420 | 419 | ||
421 | EAPI int | 420 | EAPI int |
422 | eet_dictionary_string_check(Eet_Dictionary *ed, | 421 | eet_dictionary_string_check(Eet_Dictionary *ed, |
@@ -435,5 +434,5 @@ eet_dictionary_string_check(Eet_Dictionary *ed, | |||
435 | return 1; | 434 | return 1; |
436 | 435 | ||
437 | return 0; | 436 | return 0; |
438 | } /* eet_dictionary_string_check */ | 437 | } |
439 | 438 | ||