From a665bf48d762f1bd3643da24b077b4568f94f9d9 Mon Sep 17 00:00:00 2001 From: Rafael Antognolli Date: Mon, 13 Apr 2009 22:30:32 +0000 Subject: [PATCH] Added use of eina_stringshare_replace(). SVN revision: 40030 --- legacy/ethumb/src/lib/Ethumb.c | 24 ++++++------------------ 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/legacy/ethumb/src/lib/Ethumb.c b/legacy/ethumb/src/lib/Ethumb.c index 4bd9ea6f9d..50d581af52 100644 --- a/legacy/ethumb/src/lib/Ethumb.c +++ b/legacy/ethumb/src/lib/Ethumb.c @@ -329,15 +329,9 @@ ethumb_frame_set(Ethumb *e, const char *theme_file, const char *group, const cha return 0; } - theme_file = eina_stringshare_add(theme_file); - group = eina_stringshare_add(group); - swallow = eina_stringshare_add(swallow); - eina_stringshare_del(frame->file); - eina_stringshare_del(frame->group); - eina_stringshare_del(frame->swallow); - frame->file = theme_file; - frame->group = group; - frame->swallow = swallow; + eina_stringshare_replace(&frame->file, theme_file); + eina_stringshare_replace(&frame->group, group); + eina_stringshare_replace(&frame->swallow, swallow); e->frame = frame; @@ -349,9 +343,7 @@ ethumb_thumb_dir_path_set(Ethumb *e, const char *path) { EINA_SAFETY_ON_NULL_RETURN(e); - path = eina_stringshare_add(path); - eina_stringshare_del(e->thumb_dir); - e->thumb_dir = path; + eina_stringshare_replace(&e->thumb_dir, path); } EAPI const char * @@ -367,9 +359,7 @@ ethumb_thumb_category_set(Ethumb *e, const char *category) { EINA_SAFETY_ON_NULL_RETURN(e); - category = eina_stringshare_add(category); - eina_stringshare_del(e->category); - e->category = category; + eina_stringshare_replace(&e->category, category); } EAPI const char * @@ -530,9 +520,7 @@ _ethumb_file_generate_path(Ethumb_File *ef) hash = _ethumb_generate_hash(fullname); snprintf(buf, sizeof(buf), "%s/%s/%s.%s", thumb_dir, category, hash, ext); free(fullname); - if (ef->thumb_path) - eina_stringshare_del(ef->thumb_path); - ef->thumb_path = eina_stringshare_add(buf); + eina_stringshare_replace(&ef->thumb_path, buf); eina_stringshare_del(thumb_dir); eina_stringshare_del(category);