E entry: Use stringshare instead of strdup.

The string is usually shared already and this saves us the allocation.

SVN revision: 79753
This commit is contained in:
Tom Hacohen 2012-11-27 18:14:03 +00:00
parent 9efdd5beae
commit 81efa66d66
1 changed files with 4 additions and 3 deletions

View File

@ -192,7 +192,7 @@ EAPI void
e_entry_password_set(Evas_Object *entry, int password_mode)
{
E_Entry_Smart_Data *sd;
char *text;
Eina_Stringshare *text;
if (evas_object_smart_smart_get(entry) != _e_entry_smart) SMARTERRNR();
if ((!entry) || (!(sd = evas_object_smart_data_get(entry))))
@ -200,7 +200,8 @@ e_entry_password_set(Evas_Object *entry, int password_mode)
if (sd->password_mode == password_mode)
return;
text = strdup(edje_object_part_text_get(sd->entry_object, ENTRY_PART_NAME));
text = eina_stringshare_add(
edje_object_part_text_get(sd->entry_object, ENTRY_PART_NAME));
sd->password_mode = !!password_mode;
if (!sd->password_mode)
@ -212,7 +213,7 @@ e_entry_password_set(Evas_Object *entry, int password_mode)
if (text)
{
edje_object_part_text_set(sd->entry_object, ENTRY_PART_NAME, text);
free(text);
eina_stringshare_del(text);
}
/* FIXME: Some sort of an hack to fix focus. We should just have an "update