diff options
author | Cedric BAIL <cedric.bail@free.fr> | 2008-10-15 15:12:56 +0000 |
---|---|---|
committer | Cedric BAIL <cedric.bail@free.fr> | 2008-10-15 15:12:56 +0000 |
commit | 3d6749983b0547353b900088f275c4f91abe315c (patch) | |
tree | cbce52ce14fd9b42c082f53cf411dd6ecb3ff893 /src/bin/e_path.c | |
parent | 9e02df4fefcbf970911bfca8bde929b46d8405e3 (diff) |
Switch to eina_stringshare.
This could also change the usage of string share in E17.
SVN revision: 36679
Diffstat (limited to '')
-rw-r--r-- | src/bin/e_path.c | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/src/bin/e_path.c b/src/bin/e_path.c index abf5301..3c34f7a 100644 --- a/src/bin/e_path.c +++ b/src/bin/e_path.c | |||
@@ -45,7 +45,7 @@ e_path_default_path_append(E_Path *ep, const char *path) | |||
45 | 45 | ||
46 | strcpy(new_path, home_dir); | 46 | strcpy(new_path, home_dir); |
47 | strcat(new_path, path + 1); | 47 | strcat(new_path, path + 1); |
48 | epd->dir = evas_stringshare_add(new_path); | 48 | epd->dir = eina_stringshare_add(new_path); |
49 | free(new_path); | 49 | free(new_path); |
50 | ep->default_dir_list = evas_list_append(ep->default_dir_list, epd); | 50 | ep->default_dir_list = evas_list_append(ep->default_dir_list, epd); |
51 | } | 51 | } |
@@ -55,7 +55,7 @@ e_path_default_path_append(E_Path *ep, const char *path) | |||
55 | epd = malloc(sizeof(E_Path_Dir)); | 55 | epd = malloc(sizeof(E_Path_Dir)); |
56 | if (!epd) | 56 | if (!epd) |
57 | return; | 57 | return; |
58 | epd->dir = evas_stringshare_add(path); | 58 | epd->dir = eina_stringshare_add(path); |
59 | ep->default_dir_list = evas_list_append(ep->default_dir_list, epd); | 59 | ep->default_dir_list = evas_list_append(ep->default_dir_list, epd); |
60 | } | 60 | } |
61 | _e_path_cache_free(ep); | 61 | _e_path_cache_free(ep); |
@@ -98,7 +98,7 @@ e_path_user_path_append(E_Path *ep, const char *path) | |||
98 | 98 | ||
99 | strcpy(new_path, home_dir); | 99 | strcpy(new_path, home_dir); |
100 | strcat(new_path, path + 1); | 100 | strcat(new_path, path + 1); |
101 | epd->dir = evas_stringshare_add(new_path); | 101 | epd->dir = eina_stringshare_add(new_path); |
102 | free(new_path); | 102 | free(new_path); |
103 | *(ep->user_dir_list) = evas_list_append(*(ep->user_dir_list), epd); | 103 | *(ep->user_dir_list) = evas_list_append(*(ep->user_dir_list), epd); |
104 | } | 104 | } |
@@ -108,7 +108,7 @@ e_path_user_path_append(E_Path *ep, const char *path) | |||
108 | epd = malloc(sizeof(E_Path_Dir)); | 108 | epd = malloc(sizeof(E_Path_Dir)); |
109 | if (!epd) | 109 | if (!epd) |
110 | return; | 110 | return; |
111 | epd->dir = evas_stringshare_add(path); | 111 | epd->dir = eina_stringshare_add(path); |
112 | *(ep->user_dir_list) = evas_list_append(*(ep->user_dir_list), epd); | 112 | *(ep->user_dir_list) = evas_list_append(*(ep->user_dir_list), epd); |
113 | } | 113 | } |
114 | _e_path_cache_free(ep); | 114 | _e_path_cache_free(ep); |
@@ -141,7 +141,7 @@ e_path_user_path_prepend(E_Path *ep, const char *path) | |||
141 | 141 | ||
142 | strcpy(new_path, home_dir); | 142 | strcpy(new_path, home_dir); |
143 | strcat(new_path, path + 1); | 143 | strcat(new_path, path + 1); |
144 | epd->dir = evas_stringshare_add(new_path); | 144 | epd->dir = eina_stringshare_add(new_path); |
145 | free(new_path); | 145 | free(new_path); |
146 | *(ep->user_dir_list) = evas_list_prepend(*(ep->user_dir_list), epd); | 146 | *(ep->user_dir_list) = evas_list_prepend(*(ep->user_dir_list), epd); |
147 | } | 147 | } |
@@ -151,7 +151,7 @@ e_path_user_path_prepend(E_Path *ep, const char *path) | |||
151 | epd = malloc(sizeof(E_Path_Dir)); | 151 | epd = malloc(sizeof(E_Path_Dir)); |
152 | if (!epd) | 152 | if (!epd) |
153 | return; | 153 | return; |
154 | epd->dir = evas_stringshare_add(path); | 154 | epd->dir = eina_stringshare_add(path); |
155 | *(ep->user_dir_list) = evas_list_prepend(*(ep->user_dir_list), epd); | 155 | *(ep->user_dir_list) = evas_list_prepend(*(ep->user_dir_list), epd); |
156 | } | 156 | } |
157 | _e_path_cache_free(ep); | 157 | _e_path_cache_free(ep); |
@@ -189,7 +189,7 @@ e_path_user_path_remove(E_Path *ep, const char *path) | |||
189 | { | 189 | { |
190 | *(ep->user_dir_list) = evas_list_remove_list( | 190 | *(ep->user_dir_list) = evas_list_remove_list( |
191 | *(ep->user_dir_list), l); | 191 | *(ep->user_dir_list), l); |
192 | evas_stringshare_del(epd->dir); | 192 | eina_stringshare_del(epd->dir); |
193 | free(epd); | 193 | free(epd); |
194 | free(new_path); | 194 | free(new_path); |
195 | _e_path_cache_free(ep); | 195 | _e_path_cache_free(ep); |
@@ -211,7 +211,7 @@ e_path_user_path_remove(E_Path *ep, const char *path) | |||
211 | { | 211 | { |
212 | *(ep->user_dir_list) = evas_list_remove_list( | 212 | *(ep->user_dir_list) = evas_list_remove_list( |
213 | *(ep->user_dir_list), l); | 213 | *(ep->user_dir_list), l); |
214 | evas_stringshare_del(epd->dir); | 214 | eina_stringshare_del(epd->dir); |
215 | free(epd); | 215 | free(epd); |
216 | _e_path_cache_free(ep); | 216 | _e_path_cache_free(ep); |
217 | return; | 217 | return; |
@@ -229,7 +229,7 @@ e_path_user_path_clear(E_Path *ep) | |||
229 | E_Path_Dir *epd; | 229 | E_Path_Dir *epd; |
230 | epd = (*(ep->user_dir_list))->data; | 230 | epd = (*(ep->user_dir_list))->data; |
231 | *(ep->user_dir_list) = evas_list_remove_list(*(ep->user_dir_list), *(ep->user_dir_list)); | 231 | *(ep->user_dir_list) = evas_list_remove_list(*(ep->user_dir_list), *(ep->user_dir_list)); |
232 | evas_stringshare_del(epd->dir); | 232 | eina_stringshare_del(epd->dir); |
233 | free(epd); | 233 | free(epd); |
234 | } | 234 | } |
235 | _e_path_cache_free(ep); | 235 | _e_path_cache_free(ep); |
@@ -247,7 +247,7 @@ e_path_find(E_Path *ep, const char *file) | |||
247 | 247 | ||
248 | if (!file) return NULL; | 248 | if (!file) return NULL; |
249 | str = evas_hash_find(ep->hash, file); | 249 | str = evas_hash_find(ep->hash, file); |
250 | if (str) return evas_stringshare_add(str); | 250 | if (str) return eina_stringshare_add(str); |
251 | /* Look in the default dir list */ | 251 | /* Look in the default dir list */ |
252 | for (l = ep->default_dir_list; l; l = l->next) | 252 | for (l = ep->default_dir_list; l; l = l->next) |
253 | { | 253 | { |
@@ -262,8 +262,8 @@ e_path_find(E_Path *ep, const char *file) | |||
262 | if (evas_hash_size(ep->hash) >= 512) | 262 | if (evas_hash_size(ep->hash) >= 512) |
263 | _e_path_cache_free(ep); | 263 | _e_path_cache_free(ep); |
264 | ep->hash = evas_hash_add(ep->hash, file, | 264 | ep->hash = evas_hash_add(ep->hash, file, |
265 | evas_stringshare_add(buf)); | 265 | eina_stringshare_add(buf)); |
266 | return evas_stringshare_add(buf); | 266 | return eina_stringshare_add(buf); |
267 | } | 267 | } |
268 | } | 268 | } |
269 | } | 269 | } |
@@ -281,8 +281,8 @@ e_path_find(E_Path *ep, const char *file) | |||
281 | if (evas_hash_size(ep->hash) >= 512) | 281 | if (evas_hash_size(ep->hash) >= 512) |
282 | _e_path_cache_free(ep); | 282 | _e_path_cache_free(ep); |
283 | ep->hash = evas_hash_add(ep->hash, file, | 283 | ep->hash = evas_hash_add(ep->hash, file, |
284 | evas_stringshare_add(buf)); | 284 | eina_stringshare_add(buf)); |
285 | return evas_stringshare_add(buf); | 285 | return eina_stringshare_add(buf); |
286 | } | 286 | } |
287 | } | 287 | } |
288 | } | 288 | } |
@@ -307,7 +307,7 @@ e_path_evas_append(E_Path *ep, Evas *evas) | |||
307 | 307 | ||
308 | epd = l->data; | 308 | epd = l->data; |
309 | if (epd->dir) evas_font_path_append(evas, epd->dir); | 309 | if (epd->dir) evas_font_path_append(evas, epd->dir); |
310 | evas_stringshare_del(epd->dir); | 310 | eina_stringshare_del(epd->dir); |
311 | free(epd); | 311 | free(epd); |
312 | } | 312 | } |
313 | if (dir_list) evas_list_free(dir_list); | 313 | if (dir_list) evas_list_free(dir_list); |
@@ -330,7 +330,7 @@ e_path_dir_list_get(E_Path *ep) | |||
330 | { | 330 | { |
331 | epd = l->data; | 331 | epd = l->data; |
332 | new_epd = malloc(sizeof(E_Path_Dir)); | 332 | new_epd = malloc(sizeof(E_Path_Dir)); |
333 | new_epd->dir = evas_stringshare_add(epd->dir); | 333 | new_epd->dir = eina_stringshare_add(epd->dir); |
334 | dir_list = evas_list_append(dir_list, new_epd); | 334 | dir_list = evas_list_append(dir_list, new_epd); |
335 | } | 335 | } |
336 | } | 336 | } |
@@ -339,7 +339,7 @@ e_path_dir_list_get(E_Path *ep) | |||
339 | { | 339 | { |
340 | epd = l->data; | 340 | epd = l->data; |
341 | new_epd = malloc(sizeof(E_Path_Dir)); | 341 | new_epd = malloc(sizeof(E_Path_Dir)); |
342 | new_epd->dir = evas_stringshare_add(epd->dir); | 342 | new_epd->dir = eina_stringshare_add(epd->dir); |
343 | dir_list = evas_list_append(dir_list, new_epd); | 343 | dir_list = evas_list_append(dir_list, new_epd); |
344 | } | 344 | } |
345 | 345 | ||
@@ -355,7 +355,7 @@ e_path_dir_list_free(Evas_List *dir_list) | |||
355 | { | 355 | { |
356 | epd = dir_list->data; | 356 | epd = dir_list->data; |
357 | dir_list = evas_list_remove_list(dir_list, dir_list); | 357 | dir_list = evas_list_remove_list(dir_list, dir_list); |
358 | evas_stringshare_del(epd->dir); | 358 | eina_stringshare_del(epd->dir); |
359 | free(epd); | 359 | free(epd); |
360 | } | 360 | } |
361 | } | 361 | } |
@@ -369,7 +369,7 @@ _e_path_free(E_Path *ep) | |||
369 | { | 369 | { |
370 | E_Path_Dir *epd; | 370 | E_Path_Dir *epd; |
371 | epd = ep->default_dir_list->data; | 371 | epd = ep->default_dir_list->data; |
372 | evas_stringshare_del(epd->dir); | 372 | eina_stringshare_del(epd->dir); |
373 | free(epd); | 373 | free(epd); |
374 | ep->default_dir_list = evas_list_remove_list(ep->default_dir_list, | 374 | ep->default_dir_list = evas_list_remove_list(ep->default_dir_list, |
375 | ep->default_dir_list); | 375 | ep->default_dir_list); |
@@ -389,6 +389,6 @@ _e_path_cache_free(E_Path *ep) | |||
389 | static Evas_Bool | 389 | static Evas_Bool |
390 | _e_path_cache_free_cb(const Evas_Hash *hash __UNUSED__, const char *key __UNUSED__, void *data, void *fdata __UNUSED__) | 390 | _e_path_cache_free_cb(const Evas_Hash *hash __UNUSED__, const char *key __UNUSED__, void *data, void *fdata __UNUSED__) |
391 | { | 391 | { |
392 | evas_stringshare_del(data); | 392 | eina_stringshare_del(data); |
393 | return 1; | 393 | return 1; |
394 | } | 394 | } |