summaryrefslogtreecommitdiff
path: root/src/lib/edje
diff options
context:
space:
mode:
authorCedric BAIL <cedric@osg.samsung.com>2015-01-05 10:52:46 +0100
committerCedric BAIL <cedric@osg.samsung.com>2015-01-05 10:52:59 +0100
commit93da127573158536aa866d8102254f8ff8b44c95 (patch)
tree8f5faa2f5f5ebfc7da32a5c002103b901bdf38da /src/lib/edje
parentd41b77ec21858611cf308f5c330bb520579a2570 (diff)
edje: Edje_Edit - remake deletion and replacing of strings
Summary: Add new function for replacing string with using eina_stringshare_replace() and change _edje_if_string_free() to setup passed string to NULL. @fix Reviewers: raster, Hermet, seoz, cedric Reviewed By: cedric Subscribers: reutskiy.v.v Projects: #efl Differential Revision: https://phab.enlightenment.org/D1835 Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
Diffstat (limited to 'src/lib/edje')
-rw-r--r--src/lib/edje/edje_edit.c195
1 files changed, 88 insertions, 107 deletions
diff --git a/src/lib/edje/edje_edit.c b/src/lib/edje/edje_edit.c
index 18c45b72d0..bb35f3836f 100644
--- a/src/lib/edje/edje_edit.c
+++ b/src/lib/edje/edje_edit.c
@@ -776,16 +776,30 @@ _edje_fix_parts_id(Edje *ed)
776} 776}
777 777
778static void 778static void
779_edje_if_string_free(Edje *ed, const char *str) 779_edje_if_string_free(Edje *ed, const char **str)
780{ 780{
781 Eet_Dictionary *dict; 781 Eet_Dictionary *dict;
782 782
783 if (!ed || !str) return; 783 if (!ed || !str) return;
784 784
785 dict = eet_dictionary_get(ed->file->ef); 785 dict = eet_dictionary_get(ed->file->ef);
786 if (eet_dictionary_string_check(dict, str)) return; 786 if (eet_dictionary_string_check(dict, *str)) return;
787 eina_stringshare_del(str); 787 eina_stringshare_del(*str);
788 str = NULL; 788 *str = NULL;
789}
790
791static void
792_edje_if_string_replace(Edje *ed, const char **str, const char *str_new)
793{
794 Eet_Dictionary *dict;
795
796 if (!ed || !str) return;
797
798 dict = eet_dictionary_get(ed->file->ef);
799 if (*str && eet_dictionary_string_check(dict, *str))
800 *str = eina_stringshare_add(str_new);
801 else
802 eina_stringshare_replace(str, str_new);
789} 803}
790 804
791static Edje_Style * 805static Edje_Style *
@@ -1015,8 +1029,7 @@ _delete_play_actions(Evas_Object *obj, const char* name, int action_type, Eet_Fi
1015 { 1029 {
1016 program->speed = 0; 1030 program->speed = 0;
1017 program->channel = EDJE_CHANNEL_EFFECT; 1031 program->channel = EDJE_CHANNEL_EFFECT;
1018 _edje_if_string_free(eed, program->sample_name); 1032 _edje_if_string_free(eed, &program->sample_name);
1019 program->sample_name = NULL;
1020 program->action = EDJE_ACTION_TYPE_NONE; 1033 program->action = EDJE_ACTION_TYPE_NONE;
1021 is_collection_changed = EINA_TRUE; 1034 is_collection_changed = EINA_TRUE;
1022 } 1035 }
@@ -1024,8 +1037,7 @@ _delete_play_actions(Evas_Object *obj, const char* name, int action_type, Eet_Fi
1024 !strcmp(program->tone_name, name)) 1037 !strcmp(program->tone_name, name))
1025 { 1038 {
1026 program->duration = 0; 1039 program->duration = 0;
1027 _edje_if_string_free(eed, program->tone_name); 1040 _edje_if_string_free(eed, &program->tone_name);
1028 program->tone_name = NULL;
1029 program->action = EDJE_ACTION_TYPE_NONE; 1041 program->action = EDJE_ACTION_TYPE_NONE;
1030 is_collection_changed = EINA_TRUE; 1042 is_collection_changed = EINA_TRUE;
1031 } 1043 }
@@ -1173,7 +1185,7 @@ edje_edit_sound_sample_del(Evas_Object *obj, const char* name)
1173 return EINA_FALSE; 1185 return EINA_FALSE;
1174 } 1186 }
1175 1187
1176 _edje_if_string_free(ed, sound_sample->name); 1188 _edje_if_string_free(ed, &sound_sample->name);
1177 --ed->file->sound_dir->samples_count; 1189 --ed->file->sound_dir->samples_count;
1178 1190
1179 sound_sample_last = ed->file->sound_dir->samples + 1191 sound_sample_last = ed->file->sound_dir->samples +
@@ -1287,8 +1299,7 @@ edje_edit_sound_tone_del(Evas_Object *obj, const char* name)
1287 return EINA_FALSE; 1299 return EINA_FALSE;
1288 } 1300 }
1289 1301
1290 1302 _edje_if_string_free(ed, &sound_tone->name);
1291 _edje_if_string_free(ed, sound_tone->name);
1292 --ed->file->sound_dir->tones_count; 1303 --ed->file->sound_dir->tones_count;
1293 1304
1294 Edje_Sound_Tone *sound_tone_last = ed->file->sound_dir->tones + 1305 Edje_Sound_Tone *sound_tone_last = ed->file->sound_dir->tones +
@@ -1988,7 +1999,7 @@ edje_edit_group_limits_##TYPE##_del(Evas_Object * obj, const char * name, int va
1988 if ((ed->collection->limits.TYPE[i]->value == value) \ 1999 if ((ed->collection->limits.TYPE[i]->value == value) \
1989 && (!strcmp(ed->collection->limits.TYPE[i]->name, name))) \ 2000 && (!strcmp(ed->collection->limits.TYPE[i]->name, name))) \
1990 { \ 2001 { \
1991 _edje_if_string_free(ed, ed->collection->limits.TYPE[i]->name); \ 2002 _edje_if_string_free(ed, &ed->collection->limits.TYPE[i]->name); \
1992 free(ed->collection->limits.TYPE[i]); \ 2003 free(ed->collection->limits.TYPE[i]); \
1993 if (i < new_count) \ 2004 if (i < new_count) \
1994 { \ 2005 { \
@@ -2289,7 +2300,7 @@ edje_edit_group_data_del(Evas_Object *obj, const char *key)
2289 if (!value) return EINA_FALSE; 2300 if (!value) return EINA_FALSE;
2290 2301
2291 eina_hash_del(ed->collection->data, key, value); 2302 eina_hash_del(ed->collection->data, key, value);
2292 _edje_if_string_free(ed, value->str); 2303 _edje_if_string_free(ed, &value->str);
2293 free(value); 2304 free(value);
2294 2305
2295 return EINA_TRUE; 2306 return EINA_TRUE;
@@ -2310,7 +2321,7 @@ edje_edit_data_del(Evas_Object *obj, const char *itemname)
2310 return EINA_FALSE; 2321 return EINA_FALSE;
2311 2322
2312 eina_hash_del(ed->file->data, itemname, value); 2323 eina_hash_del(ed->file->data, itemname, value);
2313 _edje_if_string_free(ed, value->str); 2324 _edje_if_string_free(ed, &value->str);
2314 free(value); 2325 free(value);
2315 2326
2316 return EINA_TRUE; 2327 return EINA_TRUE;
@@ -2363,10 +2374,9 @@ edje_edit_group_data_value_set(Evas_Object *obj, const char *key, const char *va
2363 es = eina_hash_find(ed->collection->data, key); 2374 es = eina_hash_find(ed->collection->data, key);
2364 if (es) 2375 if (es)
2365 { 2376 {
2366 _edje_if_string_free(ed, es->str); 2377 _edje_if_string_replace(ed, &es->str, value);
2367 es->str = eina_stringshare_add(value);
2368 es->id = 0; 2378 es->id = 0;
2369 return EINA_TRUE; 2379 return EINA_TRUE;
2370 } 2380 }
2371 2381
2372 return EINA_FALSE; 2382 return EINA_FALSE;
@@ -2385,8 +2395,7 @@ edje_edit_data_value_set(Evas_Object *obj, const char *itemname, const char *val
2385 es = eina_hash_find(ed->file->data, itemname); 2395 es = eina_hash_find(ed->file->data, itemname);
2386 if (es) 2396 if (es)
2387 { 2397 {
2388 _edje_if_string_free(ed, es->str); 2398 _edje_if_string_replace(ed, &es->str, value);
2389 es->str = eina_stringshare_add(value);
2390 es->id = 0; 2399 es->id = 0;
2391 return EINA_TRUE; 2400 return EINA_TRUE;
2392 } 2401 }
@@ -2549,7 +2558,7 @@ edje_edit_color_class_del(Evas_Object *obj, const char *name)
2549 EINA_LIST_FOREACH(ed->file->color_classes, l, cc) 2558 EINA_LIST_FOREACH(ed->file->color_classes, l, cc)
2550 if (strcmp(cc->name, name) == 0) 2559 if (strcmp(cc->name, name) == 0)
2551 { 2560 {
2552 _edje_if_string_free(ed, cc->name); 2561 _edje_if_string_free(ed, &cc->name);
2553 ed->file->color_classes = eina_list_remove(ed->file->color_classes, cc); 2562 ed->file->color_classes = eina_list_remove(ed->file->color_classes, cc);
2554 free(cc); 2563 free(cc);
2555 return EINA_TRUE; 2564 return EINA_TRUE;
@@ -2571,9 +2580,8 @@ edje_edit_color_class_name_set(Evas_Object *obj, const char *name, const char *n
2571 EINA_LIST_FOREACH(ed->file->color_classes, l, cc) 2580 EINA_LIST_FOREACH(ed->file->color_classes, l, cc)
2572 if (!strcmp(cc->name, name)) 2581 if (!strcmp(cc->name, name))
2573 { 2582 {
2574 _edje_if_string_free(ed, cc->name); 2583 _edje_if_string_replace(ed, &cc->name, newname);
2575 cc->name = (char*)eina_stringshare_add(newname); 2584 return EINA_TRUE;
2576 return EINA_TRUE;
2577 } 2585 }
2578 2586
2579 return EINA_FALSE; 2587 return EINA_FALSE;
@@ -2636,7 +2644,7 @@ edje_edit_style_del(Evas_Object * obj, const char* style)
2636 2644
2637 ed->file->styles = eina_list_remove(ed->file->styles, s); 2645 ed->file->styles = eina_list_remove(ed->file->styles, s);
2638 2646
2639 _edje_if_string_free(ed, s->name); 2647 _edje_if_string_free(ed, (const char **)&s->name);
2640 //~ //s->style HOWTO FREE ??? 2648 //~ //s->style HOWTO FREE ???
2641 while (s->tags) 2649 while (s->tags)
2642 { 2650 {
@@ -2645,10 +2653,10 @@ edje_edit_style_del(Evas_Object * obj, const char* style)
2645 t = s->tags->data; 2653 t = s->tags->data;
2646 2654
2647 s->tags = eina_list_remove(s->tags, t); 2655 s->tags = eina_list_remove(s->tags, t);
2648 _edje_if_string_free(ed, t->key); 2656 _edje_if_string_free(ed, &t->key);
2649 _edje_if_string_free(ed, t->value); 2657 _edje_if_string_free(ed, &t->value);
2650 _edje_if_string_free(ed, t->font); 2658 _edje_if_string_free(ed, &t->font);
2651 _edje_if_string_free(ed, t->text_class); 2659 _edje_if_string_free(ed, &t->text_class);
2652 free(t); 2660 free(t);
2653 t = NULL; 2661 t = NULL;
2654 } 2662 }
@@ -2691,8 +2699,7 @@ edje_edit_style_tag_name_set(Evas_Object * obj, const char* style, const char* t
2691 2699
2692 t = _edje_edit_style_tag_get(ed, style, tag); 2700 t = _edje_edit_style_tag_get(ed, style, tag);
2693 if (!t) return EINA_FALSE; 2701 if (!t) return EINA_FALSE;
2694 _edje_if_string_free(ed, t->key); 2702 _edje_if_string_replace(ed, &t->key, new_name);
2695 t->key = eina_stringshare_add(new_name);
2696 return EINA_TRUE; 2703 return EINA_TRUE;
2697} 2704}
2698 2705
@@ -2726,8 +2733,7 @@ edje_edit_style_tag_value_set(Evas_Object * obj, const char* style, const char*
2726 2733
2727 t = _edje_edit_style_tag_get(ed, style, tag); 2734 t = _edje_edit_style_tag_get(ed, style, tag);
2728 if (!t) return EINA_FALSE; 2735 if (!t) return EINA_FALSE;
2729 _edje_if_string_free(ed, t->value); 2736 _edje_if_string_replace(ed, &t->value, new_value);
2730 t->value = eina_stringshare_add(new_value);
2731 return EINA_TRUE; 2737 return EINA_TRUE;
2732} 2738}
2733 2739
@@ -2771,10 +2777,10 @@ edje_edit_style_tag_del(Evas_Object * obj, const char* style, const char* tag)
2771 if (!s || !t) return EINA_FALSE; 2777 if (!s || !t) return EINA_FALSE;
2772 2778
2773 s->tags = eina_list_remove(s->tags, t); 2779 s->tags = eina_list_remove(s->tags, t);
2774 _edje_if_string_free(ed, t->key); 2780 _edje_if_string_free(ed, &t->key);
2775 _edje_if_string_free(ed, t->value); 2781 _edje_if_string_free(ed, &t->value);
2776 _edje_if_string_free(ed, t->font); 2782 _edje_if_string_free(ed, &t->font);
2777 _edje_if_string_free(ed, t->text_class); 2783 _edje_if_string_free(ed, &t->text_class);
2778 free(t); 2784 free(t);
2779 t = NULL; 2785 t = NULL;
2780 return EINA_TRUE; 2786 return EINA_TRUE;
@@ -2854,7 +2860,7 @@ edje_edit_external_del(Evas_Object *obj, const char *external)
2854 e = _edje_edit_external_get(ed, external); 2860 e = _edje_edit_external_get(ed, external);
2855 if (!e) return EINA_FALSE; 2861 if (!e) return EINA_FALSE;
2856 2862
2857 _edje_if_string_free(ed, e->entry); 2863 _edje_if_string_free(ed, &e->entry);
2858 e->entry = NULL; 2864 e->entry = NULL;
2859 2865
2860 return EINA_TRUE; 2866 return EINA_TRUE;
@@ -2948,8 +2954,7 @@ edje_edit_part_name_set(Evas_Object *obj, const char* part, const char* new_name
2948 2954
2949 //printf("Set name of part: %s [new name: %s]\n", part, new_name); 2955 //printf("Set name of part: %s [new name: %s]\n", part, new_name);
2950 2956
2951 _edje_if_string_free(ed, rp->part->name); 2957 _edje_if_string_replace(ed, &rp->part->name, new_name);
2952 rp->part->name = (char *)eina_stringshare_add(new_name);
2953 2958
2954 _edje_edit_flag_script_dirty(eed, EINA_TRUE); 2959 _edje_edit_flag_script_dirty(eed, EINA_TRUE);
2955 2960
@@ -2967,8 +2972,7 @@ edje_edit_part_name_set(Evas_Object *obj, const char* part, const char* new_name
2967 edje_edit_part_api_##Value##_set(Evas_Object *obj, const char *part, const char *s) \ 2972 edje_edit_part_api_##Value##_set(Evas_Object *obj, const char *part, const char *s) \
2968 { \ 2973 { \
2969 GET_RP_OR_RETURN(EINA_FALSE); \ 2974 GET_RP_OR_RETURN(EINA_FALSE); \
2970 _edje_if_string_free(ed, rp->part->api.Value); \ 2975 _edje_if_string_replace(ed, &rp->part->api.Value, s); \
2971 rp->part->api.Value = eina_stringshare_add(s); \
2972 return EINA_TRUE; \ 2976 return EINA_TRUE; \
2973 } 2977 }
2974 2978
@@ -3134,9 +3138,9 @@ _edje_edit_real_part_add(Evas_Object *obj, const char *name, Edje_Part_Type type
3134 /* Create default description */ 3138 /* Create default description */
3135 if (!edje_edit_state_add(obj, name, "default", 0.0)) 3139 if (!edje_edit_state_add(obj, name, "default", 0.0))
3136 { 3140 {
3137 _edje_if_string_free(ed, ep->name); 3141 _edje_if_string_free(ed, &ep->name);
3138 if (source) 3142 if (source)
3139 _edje_if_string_free(ed, ep->source); 3143 _edje_if_string_free(ed, &ep->source);
3140 eina_mempool_free(ce->mp.part, ep); 3144 eina_mempool_free(ce->mp.part, ep);
3141 eina_mempool_free(_edje_real_part_mp, rp); 3145 eina_mempool_free(_edje_real_part_mp, rp);
3142 return EINA_FALSE; 3146 return EINA_FALSE;
@@ -3232,7 +3236,7 @@ edje_edit_part_del(Evas_Object *obj, const char* part)
3232 /* Free Edje_Part and all descriptions */ 3236 /* Free Edje_Part and all descriptions */
3233 ce = eina_hash_find(ed->file->collection, ed->group); 3237 ce = eina_hash_find(ed->file->collection, ed->group);
3234 3238
3235 _edje_if_string_free(ed, ep->name); 3239 _edje_if_string_free(ed, &ep->name);
3236 if (ep->default_desc) 3240 if (ep->default_desc)
3237 { 3241 {
3238 _edje_collection_free_part_description_free(ep->type, ep->default_desc, ce, 0); 3242 _edje_collection_free_part_description_free(ep->type, ep->default_desc, ce, 0);
@@ -3910,9 +3914,8 @@ edje_edit_part_source_set(Evas_Object *obj, const char *part, const char *source
3910 } 3914 }
3911 // this fall through case is intentional 3915 // this fall through case is intentional
3912 case EDJE_PART_TYPE_TEXTBLOCK: 3916 case EDJE_PART_TYPE_TEXTBLOCK:
3913 _edje_if_string_free(ed, rp->part->source); 3917 if (source) _edje_if_string_replace(ed, &rp->part->source, source);
3914 if (source) rp->part->source = eina_stringshare_add(source); 3918 else _edje_if_string_free(ed, &rp->part->source);
3915 else rp->part->source = NULL;
3916 return EINA_TRUE; 3919 return EINA_TRUE;
3917 case EDJE_PART_TYPE_EXTERNAL: //EXTERNAL part has source property but it cannot be changed 3920 case EDJE_PART_TYPE_EXTERNAL: //EXTERNAL part has source property but it cannot be changed
3918 break; 3921 break;
@@ -4197,7 +4200,7 @@ edje_edit_part_item_del(Evas_Object *obj, const char *part, const char* name)
4197 4200
4198 { 4201 {
4199 Edje_Pack_Element **tmp; 4202 Edje_Pack_Element **tmp;
4200 _edje_if_string_free(ed, item->name); 4203 _edje_if_string_free(ed, &item->name);
4201 --ep->items_count; 4204 --ep->items_count;
4202 4205
4203 while (i < ep->items_count) 4206 while (i < ep->items_count)
@@ -4712,16 +4715,14 @@ edje_edit_state_name_set(Evas_Object *obj, const char *part, const char *state,
4712 !strcmp(epr->state, pd->state.name) && 4715 !strcmp(epr->state, pd->state.name) &&
4713 pd->state.value == epr->value) 4716 pd->state.value == epr->value)
4714 { 4717 {
4715 _edje_if_string_free(ed, epr->state); 4718 _edje_if_string_replace(ed, &epr->state, new_name);
4716 epr->state = eina_stringshare_add(new_name);
4717 epr->value = value; 4719 epr->value = value;
4718 } 4720 }
4719 } 4721 }
4720 } 4722 }
4721 4723
4722 /* set name */ 4724 /* set name */
4723 _edje_if_string_free(ed, pd->state.name); 4725 _edje_if_string_replace(ed, &pd->state.name, new_name);
4724 pd->state.name = (char *)eina_stringshare_add(new_name);
4725 /* set value */ 4726 /* set value */
4726 pd->state.value = new_value; 4727 pd->state.value = new_value;
4727 4728
@@ -5076,9 +5077,10 @@ _edje_edit_part_state_copy(Evas_Object *obj, const char *part, const char *part_
5076 rpto->part->other.desc[rpto->part->other.desc_count++] = pdto; 5077 rpto->part->other.desc[rpto->part->other.desc_count++] = pdto;
5077 } 5078 }
5078 5079
5080
5079#define PD_STRING_COPY(To, From, _x) \ 5081#define PD_STRING_COPY(To, From, _x) \
5080 _edje_if_string_free(ed, To->_x); \ 5082 if (From->_x) \
5081 To->_x = (char *)eina_stringshare_add(From->_x); 5083 To->_x = (char *)eina_stringshare_add(From->_x);
5082 5084
5083 /* Copy all value */ 5085 /* Copy all value */
5084 *pdto = *pdfrom; 5086 *pdto = *pdfrom;
@@ -5169,9 +5171,9 @@ _edje_edit_part_state_copy(Evas_Object *obj, const char *part, const char *part_
5169 /* XXX: optimize this, most likely we don't need to remove and add */ 5171 /* XXX: optimize this, most likely we don't need to remove and add */
5170 EINA_LIST_FREE(ext_to->external_params, p) 5172 EINA_LIST_FREE(ext_to->external_params, p)
5171 { 5173 {
5172 _edje_if_string_free(ed, p->name); 5174 _edje_if_string_free(ed, &p->name);
5173 if (p->s) 5175 if (p->s)
5174 _edje_if_string_free(ed, p->s); 5176 _edje_if_string_free(ed, &p->s);
5175 free(p); 5177 free(p);
5176 } 5178 }
5177 EINA_LIST_FOREACH(ext_from->external_params, l, p) 5179 EINA_LIST_FOREACH(ext_from->external_params, l, p)
@@ -6042,8 +6044,7 @@ edje_edit_state_external_param_set(Evas_Object *obj, const char *part, const cha
6042 p->type = type; 6044 p->type = type;
6043 p->i = 0; 6045 p->i = 0;
6044 p->d = 0; 6046 p->d = 0;
6045 _edje_if_string_free(ed, p->s); 6047 _edje_if_string_free(ed, &p->s);
6046 p->s = NULL;
6047 6048
6048 switch (type) 6049 switch (type)
6049 { 6050 {
@@ -6080,7 +6081,7 @@ edje_edit_state_external_param_set(Evas_Object *obj, const char *part, const cha
6080 if ((type == EDJE_EXTERNAL_PARAM_TYPE_CHOICE) || 6081 if ((type == EDJE_EXTERNAL_PARAM_TYPE_CHOICE) ||
6081 (type == EDJE_EXTERNAL_PARAM_TYPE_STRING)) 6082 (type == EDJE_EXTERNAL_PARAM_TYPE_STRING))
6082 { 6083 {
6083 _edje_if_string_free(ed, p->s); 6084 _edje_if_string_free(ed, &p->s);
6084 if (!found) free(p); 6085 if (!found) free(p);
6085 else *p = old_p; 6086 else *p = old_p;
6086 eina_stringshare_del(sname); 6087 eina_stringshare_del(sname);
@@ -6532,8 +6533,7 @@ edje_edit_state_text_set(Evas_Object *obj, const char *part, const char *state,
6532 6533
6533 txt = (Edje_Part_Description_Text *) pd; 6534 txt = (Edje_Part_Description_Text *) pd;
6534 6535
6535 _edje_if_string_free(ed, txt->text.text.str); 6536 _edje_if_string_replace(ed, &txt->text.text.str, text);
6536 txt->text.text.str = (char *)eina_stringshare_add(text);
6537 txt->text.text.id = 0; 6537 txt->text.text.id = 0;
6538 6538
6539 for (i = 0; i < ed->table_parts_size; i++) 6539 for (i = 0; i < ed->table_parts_size; i++)
@@ -6544,8 +6544,7 @@ edje_edit_state_text_set(Evas_Object *obj, const char *part, const char *state,
6544 (real->typedata.text) && (real->typedata.text->text_source == rp)) 6544 (real->typedata.text) && (real->typedata.text->text_source == rp))
6545 { 6545 {
6546 txt = _edje_real_part_text_text_source_description_get(real, NULL); 6546 txt = _edje_real_part_text_text_source_description_get(real, NULL);
6547 _edje_if_string_free(ed, txt->text.text.str); 6547 _edje_if_string_replace(ed, &txt->text.text.str, text);
6548 txt->text.text.str = (char *)eina_stringshare_add(text);
6549 txt->text.text.id = 0; 6548 txt->text.text.id = 0;
6550 } 6549 }
6551 } 6550 }
@@ -6904,8 +6903,7 @@ edje_edit_state_font_set(Evas_Object *obj, const char *part, const char *state,
6904 6903
6905 txt = (Edje_Part_Description_Text*) pd; 6904 txt = (Edje_Part_Description_Text*) pd;
6906 6905
6907 _edje_if_string_free(ed, txt->text.font.str); 6906 _edje_if_string_replace(ed, &txt->text.font.str, font);
6908 txt->text.font.str = (char *)eina_stringshare_add(font);
6909 txt->text.font.id = 0; 6907 txt->text.font.id = 0;
6910 6908
6911 edje_object_calc_force(obj); 6909 edje_object_calc_force(obj);
@@ -6981,8 +6979,7 @@ edje_edit_state_text_text_source_set(Evas_Object *obj, const char *part, const c
6981 txt->text.id_text_source = id_text_source; 6979 txt->text.id_text_source = id_text_source;
6982 6980
6983 text_source = source_txt->text.text.str; 6981 text_source = source_txt->text.text.str;
6984 _edje_if_string_free(ed, txt->text.text.str); 6982 _edje_if_string_replace(ed, &txt->text.text.str, text_source);
6985 txt->text.text.str = eina_stringshare_add(text_source);
6986 txt->text.text.id = 0; 6983 txt->text.text.id = 0;
6987 } 6984 }
6988 else 6985 else
@@ -7106,8 +7103,7 @@ edje_edit_state_text_repch_set(Evas_Object *obj, const char *part, const char *s
7106 return EINA_FALSE; 7103 return EINA_FALSE;
7107 7104
7108 txt = (Edje_Part_Description_Text*) pd; 7105 txt = (Edje_Part_Description_Text*) pd;
7109 _edje_if_string_free(ed, txt->text.repch.str); 7106 _edje_if_string_replace(ed, &txt->text.repch.str, repch);
7110 txt->text.repch.str = eina_stringshare_add(repch);
7111 txt->text.repch.id = 0; 7107 txt->text.repch.id = 0;
7112 7108
7113 edje_object_calc_force(obj); 7109 edje_object_calc_force(obj);
@@ -7488,7 +7484,7 @@ edje_edit_image_del(Evas_Object *obj, const char* name)
7488 eet_write(eetf, entry, data, size, 0); 7484 eet_write(eetf, entry, data, size, 0);
7489 } 7485 }
7490 7486
7491 _edje_if_string_free(ed, de->entry); 7487 _edje_if_string_free(ed, &de->entry);
7492 --ed->file->image_dir->entries_count; 7488 --ed->file->image_dir->entries_count;
7493 7489
7494 if (de_last->id != de->id) 7490 if (de_last->id != de->id)
@@ -7572,8 +7568,7 @@ edje_edit_image_data_add(Evas_Object *obj, const char *name, int id)
7572 if ((unsigned int) id >= ed->file->image_dir->entries_count) return EINA_FALSE; 7568 if ((unsigned int) id >= ed->file->image_dir->entries_count) return EINA_FALSE;
7573 7569
7574 de = ed->file->image_dir->entries + id; 7570 de = ed->file->image_dir->entries + id;
7575 _edje_if_string_free(ed, de->entry); 7571 _edje_if_string_replace(ed, &de->entry, name);
7576 de->entry = eina_stringshare_add(name);
7577 de->source_type = 1; 7572 de->source_type = 1;
7578 de->source_param = 1; 7573 de->source_param = 1;
7579 7574
@@ -8144,15 +8139,15 @@ edje_edit_program_del(Evas_Object *obj, const char *prog)
8144 } 8139 }
8145 8140
8146 //Free Edje_Program 8141 //Free Edje_Program
8147 _edje_if_string_free(ed, epr->name); 8142 _edje_if_string_free(ed, &epr->name);
8148 _edje_if_string_free(ed, epr->signal); 8143 _edje_if_string_free(ed, &epr->signal);
8149 _edje_if_string_free(ed, epr->source); 8144 _edje_if_string_free(ed, &epr->source);
8150 _edje_if_string_free(ed, epr->filter.part); 8145 _edje_if_string_free(ed, &epr->filter.part);
8151 _edje_if_string_free(ed, epr->filter.state); 8146 _edje_if_string_free(ed, &epr->filter.state);
8152 _edje_if_string_free(ed, epr->state); 8147 _edje_if_string_free(ed, &epr->state);
8153 _edje_if_string_free(ed, epr->state2); 8148 _edje_if_string_free(ed, &epr->state2);
8154 _edje_if_string_free(ed, epr->sample_name); 8149 _edje_if_string_free(ed, &epr->sample_name);
8155 _edje_if_string_free(ed, epr->tone_name); 8150 _edje_if_string_free(ed, &epr->tone_name);
8156 8151
8157 EINA_LIST_FREE(epr->targets, prt) 8152 EINA_LIST_FREE(epr->targets, prt)
8158 free(prt); 8153 free(prt);
@@ -8288,8 +8283,7 @@ edje_edit_program_name_set(Evas_Object *obj, const char *prog, const char* new_n
8288 8283
8289 //printf("SET NAME for program: %s [new name: %s]\n", prog, new_name); 8284 //printf("SET NAME for program: %s [new name: %s]\n", prog, new_name);
8290 8285
8291 _edje_if_string_free(ed, epr->name); 8286 _edje_if_string_replace(ed, &epr->name, new_name);
8292 epr->name = eina_stringshare_add(new_name);
8293 8287
8294 _edje_edit_flag_script_dirty(eed, EINA_TRUE); 8288 _edje_edit_flag_script_dirty(eed, EINA_TRUE);
8295 8289
@@ -8316,10 +8310,9 @@ edje_edit_program_source_set(Evas_Object *obj, const char *prog, const char *sou
8316 8310
8317 /* Remove from program array */ 8311 /* Remove from program array */
8318 _edje_program_remove(ed->collection, epr); 8312 _edje_program_remove(ed->collection, epr);
8319 _edje_if_string_free(ed, epr->source);
8320 8313
8321 /* Insert it back */ 8314 /* Insert it back */
8322 epr->source = eina_stringshare_add(source); 8315 _edje_if_string_replace(ed, &epr->source, source);
8323 _edje_program_insert(ed->collection, epr); 8316 _edje_program_insert(ed->collection, epr);
8324 8317
8325 //Update patterns 8318 //Update patterns
@@ -8346,8 +8339,7 @@ edje_edit_program_sample_name_set(Evas_Object *obj, const char *prog, const char
8346 8339
8347 if (!name) return EINA_FALSE; 8340 if (!name) return EINA_FALSE;
8348 8341
8349 _edje_if_string_free(ed, epr->sample_name); 8342 _edje_if_string_replace(ed, &epr->sample_name, name);
8350 epr->sample_name = eina_stringshare_add(name);
8351 8343
8352 return EINA_TRUE; 8344 return EINA_TRUE;
8353} 8345}
@@ -8369,8 +8361,7 @@ edje_edit_program_tone_name_set(Evas_Object *obj, const char *prog, const char *
8369 8361
8370 if (!name) return EINA_FALSE; 8362 if (!name) return EINA_FALSE;
8371 8363
8372 _edje_if_string_free(ed, epr->tone_name); 8364 _edje_if_string_replace(ed, &epr->tone_name, name);
8373 epr->tone_name = eina_stringshare_add(name);
8374 8365
8375 return EINA_TRUE; 8366 return EINA_TRUE;
8376} 8367}
@@ -8450,8 +8441,7 @@ edje_edit_program_filter_part_set(Evas_Object *obj, const char *prog, const char
8450 8441
8451 if (!filter_part) return EINA_FALSE; 8442 if (!filter_part) return EINA_FALSE;
8452 8443
8453 _edje_if_string_free(ed, epr->filter.part); 8444 _edje_if_string_replace(ed, &epr->filter.part, filter_part);
8454 epr->filter.part = eina_stringshare_add(filter_part);
8455 8445
8456 return EINA_TRUE; 8446 return EINA_TRUE;
8457} 8447}
@@ -8473,8 +8463,7 @@ edje_edit_program_filter_state_set(Evas_Object *obj, const char *prog, const cha
8473 8463
8474 if (!filter_state) return EINA_FALSE; 8464 if (!filter_state) return EINA_FALSE;
8475 8465
8476 _edje_if_string_free(ed, epr->filter.state); 8466 _edje_if_string_replace(ed, &epr->filter.state, filter_state);
8477 epr->filter.state = eina_stringshare_add(filter_state);
8478 8467
8479 return EINA_TRUE; 8468 return EINA_TRUE;
8480} 8469}
@@ -8499,10 +8488,9 @@ edje_edit_program_signal_set(Evas_Object *obj, const char *prog, const char *sig
8499 8488
8500 /* Remove from program array */ 8489 /* Remove from program array */
8501 _edje_program_remove(ed->collection, epr); 8490 _edje_program_remove(ed->collection, epr);
8502 _edje_if_string_free(ed, epr->signal);
8503 8491
8504 /* Insert it back */ 8492 /* Insert it back */
8505 epr->signal = eina_stringshare_add(sig); 8493 _edje_if_string_replace(ed, &epr->signal, sig);
8506 _edje_program_insert(ed->collection, epr); 8494 _edje_program_insert(ed->collection, epr);
8507 8495
8508 //Update patterns 8496 //Update patterns
@@ -8530,8 +8518,7 @@ edje_edit_program_state_set(Evas_Object *obj, const char *prog, const char *stat
8530 8518
8531 //printf("SET STATE for program: %s\n", prog); 8519 //printf("SET STATE for program: %s\n", prog);
8532 8520
8533 _edje_if_string_free(ed, epr->state); 8521 _edje_if_string_replace(ed, &epr->state, state);
8534 epr->state = eina_stringshare_add(state);
8535 8522
8536 return EINA_TRUE; 8523 return EINA_TRUE;
8537} 8524}
@@ -8554,8 +8541,7 @@ edje_edit_program_state2_set(Evas_Object *obj, const char *prog, const char *sta
8554 8541
8555 //printf("SET STATE2 for program: %s\n", prog); 8542 //printf("SET STATE2 for program: %s\n", prog);
8556 8543
8557 _edje_if_string_free(ed, epr->state2); 8544 _edje_if_string_replace(ed, &epr->state2, state2);
8558 epr->state2 = eina_stringshare_add(state2);
8559 8545
8560 return EINA_TRUE; 8546 return EINA_TRUE;
8561} 8547}
@@ -9061,8 +9047,7 @@ edje_edit_program_api_name_set(Evas_Object *obj, const char *prog, const char* n
9061 GET_ED_OR_RETURN(EINA_FALSE); 9047 GET_ED_OR_RETURN(EINA_FALSE);
9062 GET_EPR_OR_RETURN(EINA_FALSE); 9048 GET_EPR_OR_RETURN(EINA_FALSE);
9063 9049
9064 _edje_if_string_free(ed, epr->api.name); 9050 _edje_if_string_replace(ed, &epr->api.name, name);
9065 epr->api.name = eina_stringshare_add(name);
9066 9051
9067 return EINA_TRUE; 9052 return EINA_TRUE;
9068} 9053}
@@ -9073,8 +9058,7 @@ edje_edit_program_api_description_set(Evas_Object *obj, const char *prog, const
9073 GET_ED_OR_RETURN(EINA_FALSE); 9058 GET_ED_OR_RETURN(EINA_FALSE);
9074 GET_EPR_OR_RETURN(EINA_FALSE); 9059 GET_EPR_OR_RETURN(EINA_FALSE);
9075 9060
9076 _edje_if_string_free(ed, epr->api.description); 9061 _edje_if_string_replace(ed, &epr->api.description, description);
9077 epr->api.description = eina_stringshare_add(description);
9078 9062
9079 return EINA_TRUE; 9063 return EINA_TRUE;
9080} 9064}
@@ -11550,10 +11534,7 @@ _edje_edit_internal_save(Evas_Object *obj, int current_only, Eina_Bool generate_
11550 11534
11551 /* Set compiler name */ 11535 /* Set compiler name */
11552 if (strcmp(ef->compiler, "edje_edit")) 11536 if (strcmp(ef->compiler, "edje_edit"))
11553 { 11537 _edje_if_string_replace(ed, &ef->compiler, "edje_edit");
11554 _edje_if_string_free(ed, ef->compiler);
11555 ef->compiler = (char *)eina_stringshare_add("edje_edit");
11556 }
11557 11538
11558 if (!_edje_edit_edje_file_save(eetf, ef)) 11539 if (!_edje_edit_edje_file_save(eetf, ef))
11559 { 11540 {