summaryrefslogtreecommitdiff
path: root/src/bin/e_path.c
diff options
context:
space:
mode:
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>2012-12-21 10:01:01 +0000
committerMike Blumenkrantz <michael.blumenkrantz@gmail.com>2012-12-21 10:01:01 +0000
commite9ea6454d9076767c1b2e996325318d0cf1c301b (patch)
tree9a10a8b5e0d6e36fffb88bea83da39b57674084e /src/bin/e_path.c
parent4ee20a2c2f91d778218056acac667a855395a530 (diff)
some stringshare improvements for e_path_find
SVN revision: 81526
Diffstat (limited to 'src/bin/e_path.c')
-rw-r--r--src/bin/e_path.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/bin/e_path.c b/src/bin/e_path.c
index f4da0d2..4d1dc64 100644
--- a/src/bin/e_path.c
+++ b/src/bin/e_path.c
@@ -232,6 +232,7 @@ e_path_find(E_Path *ep, const char *file)
232 Eina_List *l; 232 Eina_List *l;
233 E_Path_Dir *epd; 233 E_Path_Dir *epd;
234 char *str; 234 char *str;
235 Eina_Stringshare *ret;
235 char buf[PATH_MAX] = ""; 236 char buf[PATH_MAX] = "";
236 237
237 E_OBJECT_CHECK_RETURN(ep, NULL); 238 E_OBJECT_CHECK_RETURN(ep, NULL);
@@ -239,7 +240,7 @@ e_path_find(E_Path *ep, const char *file)
239 240
240 if (!file) return NULL; 241 if (!file) return NULL;
241 str = eina_hash_find(ep->hash, file); 242 str = eina_hash_find(ep->hash, file);
242 if (str) return eina_stringshare_add(str); 243 if (str) return eina_stringshare_ref(str);
243 /* Look in the default dir list */ 244 /* Look in the default dir list */
244 EINA_LIST_FOREACH(ep->default_dir_list, l, epd) 245 EINA_LIST_FOREACH(ep->default_dir_list, l, epd)
245 { 246 {
@@ -252,9 +253,9 @@ e_path_find(E_Path *ep, const char *file)
252 ep->hash = eina_hash_string_superfast_new(NULL); 253 ep->hash = eina_hash_string_superfast_new(NULL);
253 if (eina_hash_population(ep->hash) >= 512) 254 if (eina_hash_population(ep->hash) >= 512)
254 _e_path_cache_free(ep); 255 _e_path_cache_free(ep);
255 eina_hash_add(ep->hash, file, 256 ret = eina_stringshare_add(buf);
256 eina_stringshare_add(buf)); 257 eina_hash_add(ep->hash, file, ret);
257 return eina_stringshare_add(buf); 258 return eina_stringshare_ref(ret);
258 } 259 }
259 } 260 }
260 } 261 }
@@ -270,9 +271,9 @@ e_path_find(E_Path *ep, const char *file)
270 ep->hash = eina_hash_string_superfast_new(NULL); 271 ep->hash = eina_hash_string_superfast_new(NULL);
271 if (eina_hash_population(ep->hash) >= 512) 272 if (eina_hash_population(ep->hash) >= 512)
272 _e_path_cache_free(ep); 273 _e_path_cache_free(ep);
273 eina_hash_add(ep->hash, file, 274 ret = eina_stringshare_add(buf);
274 eina_stringshare_add(buf)); 275 eina_hash_add(ep->hash, file, ret);
275 return eina_stringshare_add(buf); 276 return eina_stringshare_ref(ret);
276 } 277 }
277 } 278 }
278 } 279 }