Switch ecore_strings to eina_stringshare.
SVN revision: 36676
This commit is contained in:
parent
1774413b17
commit
01befd2b67
|
@ -110,7 +110,7 @@ ef_cb_desktop_file_id(void)
|
|||
printf("Expecting id: %s, got: %s\n", tests[i].expected, id);
|
||||
ret = 0;
|
||||
}
|
||||
if (id) ecore_string_release(id);
|
||||
if (id) eina_stringshare_del(id);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
@ -19,6 +19,7 @@ EAPI int
|
|||
efreet_init(void)
|
||||
{
|
||||
if (init++) return init;
|
||||
if (!eina_stringshare_init()) return --init;
|
||||
if (!efreet_base_init()) return --init;
|
||||
if (!efreet_xml_init()) return --init;
|
||||
if (!efreet_icon_init()) return --init;
|
||||
|
@ -44,6 +45,7 @@ efreet_shutdown(void)
|
|||
efreet_icon_shutdown();
|
||||
efreet_xml_shutdown();
|
||||
efreet_base_shutdown();
|
||||
eina_stringshare_shutdown();
|
||||
|
||||
IF_FREE(efreet_lang);
|
||||
IF_FREE(efreet_lang_country);
|
||||
|
|
|
@ -21,7 +21,7 @@ static Ecore_List *efreet_dirs_get(const char *key,
|
|||
int
|
||||
efreet_base_init(void)
|
||||
{
|
||||
if (!ecore_string_init()) return 0;
|
||||
if (!eina_stringshare_init()) return 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ efreet_base_shutdown(void)
|
|||
IF_FREE_LIST(xdg_data_dirs);
|
||||
IF_FREE_LIST(xdg_config_dirs);
|
||||
|
||||
ecore_string_shutdown();
|
||||
eina_stringshare_shutdown();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -59,7 +59,7 @@ efreet_home_dir_get(void)
|
|||
if (!efreet_home_dir || efreet_home_dir[0] == '\0')
|
||||
efreet_home_dir = "/tmp";
|
||||
|
||||
efreet_home_dir = ecore_string_instance(efreet_home_dir);
|
||||
efreet_home_dir = eina_stringshare_add(efreet_home_dir);
|
||||
|
||||
return efreet_home_dir;
|
||||
}
|
||||
|
@ -160,10 +160,10 @@ efreet_dir_get(const char *key, const char *fallback)
|
|||
dir = malloc(sizeof(char) * len);
|
||||
snprintf(dir, len, "%s%s", user, fallback);
|
||||
|
||||
t = ecore_string_instance(dir);
|
||||
t = eina_stringshare_add(dir);
|
||||
FREE(dir);
|
||||
}
|
||||
else t = ecore_string_instance(dir);
|
||||
else t = eina_stringshare_add(dir);
|
||||
|
||||
return t;
|
||||
}
|
||||
|
@ -188,7 +188,7 @@ efreet_dirs_get(const char *key, const char *fallback)
|
|||
if (!path || (path[0] == '\0')) path = fallback;
|
||||
|
||||
dirs = ecore_list_new();
|
||||
ecore_list_free_cb_set(dirs, ECORE_FREE_CB(ecore_string_release));
|
||||
ecore_list_free_cb_set(dirs, ECORE_FREE_CB(eina_stringshare_del));
|
||||
if (!path) return dirs;
|
||||
|
||||
tmp = strdup(path);
|
||||
|
@ -198,13 +198,13 @@ efreet_dirs_get(const char *key, const char *fallback)
|
|||
{
|
||||
*p = '\0';
|
||||
if (!ecore_list_find(dirs, ECORE_COMPARE_CB(strcmp), s))
|
||||
ecore_list_append(dirs, (void *)ecore_string_instance(s));
|
||||
ecore_list_append(dirs, (void *)eina_stringshare_add(s));
|
||||
|
||||
s = ++p;
|
||||
p = strchr(s, ':');
|
||||
}
|
||||
if (!ecore_list_find(dirs, ECORE_COMPARE_CB(strcmp), s))
|
||||
ecore_list_append(dirs, (void *)ecore_string_instance(s));
|
||||
ecore_list_append(dirs, (void *)eina_stringshare_add(s));
|
||||
FREE(tmp);
|
||||
|
||||
return dirs;
|
||||
|
|
|
@ -113,7 +113,7 @@ int
|
|||
efreet_desktop_init(void)
|
||||
{
|
||||
if (init++) return init;
|
||||
if (!ecore_string_init()) return --init;
|
||||
if (!eina_stringshare_init()) return --init;
|
||||
if (!ecore_file_init()) return --init;
|
||||
|
||||
efreet_desktop_cache = ecore_hash_new(ecore_str_hash, ecore_str_compare);
|
||||
|
@ -146,7 +146,7 @@ efreet_desktop_shutdown(void)
|
|||
{
|
||||
if (--init) return init;
|
||||
ecore_file_shutdown();
|
||||
ecore_string_shutdown();
|
||||
eina_stringshare_shutdown();
|
||||
|
||||
IF_RELEASE(desktop_environment);
|
||||
IF_FREE_HASH(efreet_desktop_cache);
|
||||
|
@ -536,8 +536,8 @@ efreet_desktop_exec_cb(void *data, Efreet_Desktop *desktop __UNUSED__,
|
|||
EAPI void
|
||||
efreet_desktop_environment_set(const char *environment)
|
||||
{
|
||||
if (desktop_environment) ecore_string_release(desktop_environment);
|
||||
if (environment) desktop_environment = ecore_string_instance(environment);
|
||||
if (desktop_environment) eina_stringshare_del(desktop_environment);
|
||||
if (environment) desktop_environment = eina_stringshare_add(environment);
|
||||
else desktop_environment = NULL;
|
||||
}
|
||||
|
||||
|
@ -578,14 +578,14 @@ efreet_desktop_category_add(Efreet_Desktop *desktop, const char *category)
|
|||
{
|
||||
desktop->categories = ecore_list_new();
|
||||
ecore_list_free_cb_set(desktop->categories,
|
||||
ECORE_FREE_CB(ecore_string_release));
|
||||
ECORE_FREE_CB(eina_stringshare_del));
|
||||
}
|
||||
else
|
||||
if (ecore_list_find(desktop->categories,
|
||||
ECORE_COMPARE_CB(strcmp), category)) return;
|
||||
|
||||
ecore_list_append(desktop->categories,
|
||||
(void *)ecore_string_instance(category));
|
||||
(void *)eina_stringshare_add(category));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -723,7 +723,7 @@ efreet_desktop_string_list_parse(const char *string)
|
|||
list = ecore_list_new();
|
||||
if (!list) return NULL;
|
||||
|
||||
ecore_list_free_cb_set(list, ECORE_FREE_CB(ecore_string_release));
|
||||
ecore_list_free_cb_set(list, ECORE_FREE_CB(eina_stringshare_del));
|
||||
|
||||
tmp = strdup(string);
|
||||
s = tmp;
|
||||
|
@ -732,7 +732,7 @@ efreet_desktop_string_list_parse(const char *string)
|
|||
{
|
||||
if (p > tmp && *(p-1) == '\\') continue;
|
||||
*p = '\0';
|
||||
ecore_list_append(list, (void *)ecore_string_instance(s));
|
||||
ecore_list_append(list, (void *)eina_stringshare_add(s));
|
||||
s = p + 1;
|
||||
}
|
||||
/* If this is true, the .desktop file does not follow the standard */
|
||||
|
@ -742,7 +742,7 @@ efreet_desktop_string_list_parse(const char *string)
|
|||
printf("[Efreet]: Found a string list without ';' "
|
||||
"at the end: %s\n", string);
|
||||
#endif
|
||||
ecore_list_append(list, (void *)ecore_string_instance(s));
|
||||
ecore_list_append(list, (void *)eina_stringshare_add(s));
|
||||
}
|
||||
|
||||
free(tmp);
|
||||
|
@ -1006,12 +1006,12 @@ efreet_desktop_x_fields_parse(Ecore_Hash_Node *node, Efreet_Desktop *desktop)
|
|||
{
|
||||
desktop->x = ecore_hash_new(ecore_str_hash, ecore_str_compare);
|
||||
ecore_hash_free_key_cb_set(desktop->x,
|
||||
ECORE_FREE_CB(ecore_string_release));
|
||||
ECORE_FREE_CB(eina_stringshare_del));
|
||||
ecore_hash_free_value_cb_set(desktop->x,
|
||||
ECORE_FREE_CB(ecore_string_release));
|
||||
ECORE_FREE_CB(eina_stringshare_del));
|
||||
}
|
||||
ecore_hash_set(desktop->x, (void *)ecore_string_instance(node->key),
|
||||
(void *)ecore_string_instance(node->value));
|
||||
ecore_hash_set(desktop->x, (void *)eina_stringshare_add(node->key),
|
||||
(void *)eina_stringshare_add(node->value));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -199,7 +199,7 @@ efreet_icon_extension_add(const char *ext)
|
|||
* directories are used to look for icons after looking in the user icon dir
|
||||
* and before looking in standard system directories. The order of search is
|
||||
* from first to last directory in this list. the strings in the list should
|
||||
* be created with ecore_string_instance().
|
||||
* be created with eina_stringshare_add().
|
||||
*/
|
||||
EAPI Ecore_List *
|
||||
efreet_icon_extra_list_get(void)
|
||||
|
@ -256,14 +256,14 @@ efreet_icon_theme_find(const char *theme_name)
|
|||
const char *key;
|
||||
Efreet_Icon_Theme *theme;
|
||||
|
||||
key = ecore_string_instance(theme_name);
|
||||
key = eina_stringshare_add(theme_name);
|
||||
theme = ecore_hash_get(efreet_icon_themes, key);
|
||||
if (!theme)
|
||||
{
|
||||
efreet_icon_theme_dir_scan_all(theme_name);
|
||||
theme = ecore_hash_get(efreet_icon_themes, key);
|
||||
}
|
||||
ecore_string_release(key);
|
||||
eina_stringshare_del(key);
|
||||
|
||||
return theme;
|
||||
}
|
||||
|
@ -318,7 +318,7 @@ efreet_icon_find_theme_check(const char *theme_name)
|
|||
{
|
||||
theme = efreet_icon_theme_new();
|
||||
theme->fake = 1;
|
||||
theme->name.internal = ecore_string_instance(theme_name);
|
||||
theme->name.internal = eina_stringshare_add(theme_name);
|
||||
ecore_hash_set(efreet_icon_themes, (void *)theme->name.internal, theme);
|
||||
}
|
||||
|
||||
|
@ -1288,7 +1288,7 @@ efreet_icon_theme_dir_scan(const char *search_dir, const char *theme_name)
|
|||
|| !ecore_file_is_dir(path))
|
||||
continue;
|
||||
|
||||
key = ecore_string_instance(dir->d_name);
|
||||
key = eina_stringshare_add(dir->d_name);
|
||||
theme = ecore_hash_get(efreet_icon_themes, key);
|
||||
|
||||
if (!theme)
|
||||
|
@ -1302,7 +1302,7 @@ efreet_icon_theme_dir_scan(const char *search_dir, const char *theme_name)
|
|||
{
|
||||
if (theme->fake)
|
||||
theme->fake = 0;
|
||||
ecore_string_release(key);
|
||||
eina_stringshare_del(key);
|
||||
}
|
||||
|
||||
efreet_icon_theme_path_add(theme, path);
|
||||
|
@ -1356,7 +1356,7 @@ efreet_icon_theme_index_read(Efreet_Icon_Theme *theme, const char *path)
|
|||
|
||||
efreet_ini_section_set(ini, "Icon Theme");
|
||||
tmp = efreet_ini_localestring_get(ini, "Name");
|
||||
if (tmp) theme->name.name = ecore_string_instance(tmp);
|
||||
if (tmp) theme->name.name = eina_stringshare_add(tmp);
|
||||
|
||||
tmp = efreet_ini_localestring_get(ini, "Comment");
|
||||
if (tmp) theme->comment = strdup(tmp);
|
||||
|
|
|
@ -22,7 +22,7 @@ int
|
|||
efreet_ini_init(void)
|
||||
{
|
||||
if (init++) return init;
|
||||
if (!ecore_string_init()) return --init;
|
||||
if (!eina_stringshare_init()) return --init;
|
||||
return init;
|
||||
}
|
||||
|
||||
|
@ -35,7 +35,7 @@ int
|
|||
efreet_ini_shutdown(void)
|
||||
{
|
||||
if (--init) return init;
|
||||
ecore_string_shutdown();
|
||||
eina_stringshare_shutdown();
|
||||
return init;
|
||||
}
|
||||
|
||||
|
@ -101,7 +101,7 @@ efreet_ini_parse(const char *file)
|
|||
}
|
||||
|
||||
data = ecore_hash_new(ecore_str_hash, ecore_str_compare);
|
||||
ecore_hash_free_key_cb_set(data, ECORE_FREE_CB(ecore_string_release));
|
||||
ecore_hash_free_key_cb_set(data, ECORE_FREE_CB(eina_stringshare_del));
|
||||
ecore_hash_free_value_cb_set(data, ECORE_FREE_CB(ecore_hash_destroy));
|
||||
|
||||
line_start = buffer;
|
||||
|
@ -152,7 +152,7 @@ efreet_ini_parse(const char *file)
|
|||
|
||||
section = ecore_hash_new(ecore_str_hash, ecore_str_compare);
|
||||
ecore_hash_free_key_cb_set(section,
|
||||
ECORE_FREE_CB(ecore_string_release));
|
||||
ECORE_FREE_CB(eina_stringshare_del));
|
||||
ecore_hash_free_value_cb_set(section, ECORE_FREE_CB(free));
|
||||
|
||||
old = ecore_hash_remove(data, header);
|
||||
|
@ -160,7 +160,7 @@ efreet_ini_parse(const char *file)
|
|||
// "in file '%s'\n", header, file);
|
||||
|
||||
IF_FREE_HASH(old);
|
||||
ecore_hash_set(data, (void *)ecore_string_instance(header),
|
||||
ecore_hash_set(data, (void *)eina_stringshare_add(header),
|
||||
section);
|
||||
}
|
||||
else
|
||||
|
@ -236,7 +236,7 @@ efreet_ini_parse(const char *file)
|
|||
old = ecore_hash_remove(section, key);
|
||||
IF_FREE(old);
|
||||
|
||||
ecore_hash_set(section, (void *)ecore_string_instance(key),
|
||||
ecore_hash_set(section, (void *)eina_stringshare_add(key),
|
||||
efreet_ini_unescape(value));
|
||||
}
|
||||
// else
|
||||
|
@ -320,15 +320,15 @@ efreet_ini_section_add(Efreet_Ini *ini, const char *section)
|
|||
if (!ini->data)
|
||||
{
|
||||
ini->data = ecore_hash_new(ecore_str_hash, ecore_str_compare);
|
||||
ecore_hash_free_key_cb_set(ini->data, ECORE_FREE_CB(ecore_string_release));
|
||||
ecore_hash_free_key_cb_set(ini->data, ECORE_FREE_CB(eina_stringshare_del));
|
||||
ecore_hash_free_value_cb_set(ini->data, ECORE_FREE_CB(ecore_hash_destroy));
|
||||
}
|
||||
if (ecore_hash_get(ini->data, section)) return;
|
||||
|
||||
hash = ecore_hash_new(ecore_str_hash, ecore_str_compare);
|
||||
ecore_hash_free_key_cb_set(hash, ECORE_FREE_CB(ecore_string_release));
|
||||
ecore_hash_free_key_cb_set(hash, ECORE_FREE_CB(eina_stringshare_del));
|
||||
ecore_hash_free_value_cb_set(hash, ECORE_FREE_CB(free));
|
||||
ecore_hash_set(ini->data, (void *)ecore_string_instance(section), hash);
|
||||
ecore_hash_set(ini->data, (void *)eina_stringshare_add(section), hash);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -358,7 +358,7 @@ efreet_ini_string_set(Efreet_Ini *ini, const char *key, const char *value)
|
|||
{
|
||||
if (!ini || !key || !ini->section) return;
|
||||
|
||||
ecore_hash_set(ini->section, (void *)ecore_string_instance(key), strdup(value));
|
||||
ecore_hash_set(ini->section, (void *)eina_stringshare_add(key), strdup(value));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -435,7 +435,7 @@ efreet_menu_init(void)
|
|||
{NULL, NULL}
|
||||
};
|
||||
|
||||
if (!ecore_string_init()) return 0;
|
||||
if (!eina_stringshare_init()) return 0;
|
||||
if (!efreet_xml_init()) return 0;
|
||||
|
||||
efreet_menu_handle_cbs = ecore_hash_new(NULL, NULL);
|
||||
|
@ -447,36 +447,36 @@ efreet_menu_init(void)
|
|||
return 0;
|
||||
|
||||
ecore_hash_free_key_cb_set(efreet_menu_handle_cbs,
|
||||
ECORE_FREE_CB(ecore_string_release));
|
||||
ECORE_FREE_CB(eina_stringshare_del));
|
||||
ecore_hash_free_key_cb_set(efreet_menu_filter_cbs,
|
||||
ECORE_FREE_CB(ecore_string_release));
|
||||
ECORE_FREE_CB(eina_stringshare_del));
|
||||
ecore_hash_free_key_cb_set(efreet_menu_move_cbs,
|
||||
ECORE_FREE_CB(ecore_string_release));
|
||||
ECORE_FREE_CB(eina_stringshare_del));
|
||||
ecore_hash_free_key_cb_set(efreet_menu_layout_cbs,
|
||||
ECORE_FREE_CB(ecore_string_release));
|
||||
ECORE_FREE_CB(eina_stringshare_del));
|
||||
|
||||
/* set Menu into it's own so we can check the XML is valid before trying
|
||||
* to handle it */
|
||||
efreet_tag_menu = ecore_string_instance(menu_cbs[0].key);
|
||||
efreet_tag_menu = eina_stringshare_add(menu_cbs[0].key);
|
||||
|
||||
for (i = 0; menu_cbs[i].key != NULL; i++)
|
||||
ecore_hash_set(efreet_menu_handle_cbs,
|
||||
(void *)ecore_string_instance(menu_cbs[i].key),
|
||||
(void *)eina_stringshare_add(menu_cbs[i].key),
|
||||
menu_cbs[i].cb);
|
||||
|
||||
for (i = 0; filter_cbs[i].key != NULL; i++)
|
||||
ecore_hash_set(efreet_menu_filter_cbs,
|
||||
(void *)ecore_string_instance(filter_cbs[i].key),
|
||||
(void *)eina_stringshare_add(filter_cbs[i].key),
|
||||
filter_cbs[i].cb);
|
||||
|
||||
for (i = 0; move_cbs[i].key != NULL; i++)
|
||||
ecore_hash_set(efreet_menu_move_cbs,
|
||||
(void *)ecore_string_instance(move_cbs[i].key),
|
||||
(void *)eina_stringshare_add(move_cbs[i].key),
|
||||
move_cbs[i].cb);
|
||||
|
||||
for (i = 0; layout_cbs[i].key != NULL; i++)
|
||||
ecore_hash_set(efreet_menu_layout_cbs,
|
||||
(void *)ecore_string_instance(layout_cbs[i].key),
|
||||
(void *)eina_stringshare_add(layout_cbs[i].key),
|
||||
layout_cbs[i].cb);
|
||||
|
||||
return 1;
|
||||
|
@ -501,7 +501,7 @@ efreet_menu_kde_legacy_init(void)
|
|||
|
||||
efreet_menu_kde_legacy_dirs = ecore_list_new();
|
||||
ecore_list_free_cb_set(efreet_menu_kde_legacy_dirs,
|
||||
ECORE_FREE_CB(ecore_string_release));
|
||||
ECORE_FREE_CB(eina_stringshare_del));
|
||||
|
||||
/* XXX if the return from kde-config is a line longer than PATH_MAX,
|
||||
* this won't be correct (increase buffer and get the rest...) */
|
||||
|
@ -517,14 +517,14 @@ efreet_menu_kde_legacy_init(void)
|
|||
{
|
||||
*p = '\0';
|
||||
ecore_list_append(efreet_menu_kde_legacy_dirs,
|
||||
(void *)ecore_string_instance(s));
|
||||
(void *)eina_stringshare_add(s));
|
||||
s = p + 1;
|
||||
p = strchr(s, ':');
|
||||
}
|
||||
|
||||
if (*s)
|
||||
ecore_list_append(efreet_menu_kde_legacy_dirs,
|
||||
(void *)ecore_string_instance(s));
|
||||
(void *)eina_stringshare_add(s));
|
||||
|
||||
pclose(f);
|
||||
return 1;
|
||||
|
@ -552,7 +552,7 @@ efreet_menu_shutdown(void)
|
|||
IF_RELEASE(efreet_tag_menu);
|
||||
|
||||
efreet_xml_shutdown();
|
||||
ecore_string_shutdown();
|
||||
eina_stringshare_shutdown();
|
||||
}
|
||||
|
||||
EAPI Efreet_Menu *
|
||||
|
@ -816,9 +816,9 @@ efreet_menu_desktop_insert(Efreet_Menu *menu, Efreet_Desktop *desktop, int pos)
|
|||
|
||||
entry = efreet_menu_entry_new();
|
||||
entry->type = EFREET_MENU_ENTRY_DESKTOP;
|
||||
entry->id = ecore_string_instance(id);
|
||||
entry->name = ecore_string_instance(desktop->name);
|
||||
if (desktop->icon) entry->icon = ecore_string_instance(desktop->icon);
|
||||
entry->id = eina_stringshare_add(id);
|
||||
entry->name = eina_stringshare_add(desktop->name);
|
||||
if (desktop->icon) entry->icon = eina_stringshare_add(desktop->icon);
|
||||
efreet_desktop_ref(desktop);
|
||||
entry->desktop = desktop;
|
||||
|
||||
|
@ -1242,7 +1242,7 @@ efreet_menu_handle_name(Efreet_Menu_Internal *parent, Efreet_Xml *xml)
|
|||
/* ignore the name if it contains a / */
|
||||
if (strchr(xml->text, '/')) return 1;
|
||||
|
||||
parent->name.internal = ecore_string_instance(xml->text);
|
||||
parent->name.internal = eina_stringshare_add(xml->text);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
@ -1821,7 +1821,7 @@ efreet_menu_handle_legacy_dir_helper(Efreet_Menu_Internal *root,
|
|||
}
|
||||
|
||||
legacy_internal = efreet_menu_internal_new();
|
||||
legacy_internal->name.internal = ecore_string_instance(ecore_file_file_get(path));
|
||||
legacy_internal->name.internal = eina_stringshare_add(ecore_file_file_get(path));
|
||||
|
||||
/* add the legacy dir as an app dir */
|
||||
app_dir = efreet_menu_app_dir_new();
|
||||
|
@ -3056,7 +3056,7 @@ efreet_menu_resolve_moves(Efreet_Menu_Internal *internal)
|
|||
*path = '\0';
|
||||
|
||||
ancestor = efreet_menu_internal_new();
|
||||
ancestor->name.internal = ecore_string_instance(tmp);
|
||||
ancestor->name.internal = eina_stringshare_add(tmp);
|
||||
|
||||
efreet_menu_create_sub_menu_list(parent);
|
||||
ecore_list_append(parent->sub_menus, ancestor);
|
||||
|
@ -3067,7 +3067,7 @@ efreet_menu_resolve_moves(Efreet_Menu_Internal *internal)
|
|||
}
|
||||
|
||||
IF_RELEASE(origin->name.internal);
|
||||
origin->name.internal = ecore_string_instance(tmp);
|
||||
origin->name.internal = eina_stringshare_add(tmp);
|
||||
|
||||
efreet_menu_create_sub_menu_list(parent);
|
||||
ecore_list_append(parent->sub_menus, origin);
|
||||
|
@ -3405,7 +3405,7 @@ efreet_menu_app_dir_scan(Efreet_Menu_Internal *internal, const char *path, const
|
|||
|
||||
menu_desktop = efreet_menu_desktop_new();
|
||||
menu_desktop->desktop = desktop;
|
||||
menu_desktop->id = ecore_string_instance(buf2);
|
||||
menu_desktop->id = eina_stringshare_add(buf2);
|
||||
ecore_list_prepend(internal->app_pool, menu_desktop);
|
||||
}
|
||||
}
|
||||
|
@ -3593,11 +3593,11 @@ efreet_menu_layout_menu(Efreet_Menu_Internal *internal)
|
|||
/* init entry */
|
||||
entry = efreet_menu_entry_new();
|
||||
entry->type = EFREET_MENU_ENTRY_MENU;
|
||||
entry->id = ecore_string_instance(internal->name.internal);
|
||||
entry->name = ecore_string_instance(internal->name.name);
|
||||
entry->id = eina_stringshare_add(internal->name.internal);
|
||||
entry->name = eina_stringshare_add(internal->name.name);
|
||||
if (internal->directory)
|
||||
{
|
||||
entry->icon = ecore_string_instance(internal->directory->icon);
|
||||
entry->icon = eina_stringshare_add(internal->directory->icon);
|
||||
efreet_desktop_ref(internal->directory);
|
||||
entry->desktop = internal->directory;
|
||||
}
|
||||
|
@ -3671,9 +3671,9 @@ efreet_menu_layout_desktop(Efreet_Menu_Desktop *md)
|
|||
/* init entry */
|
||||
entry = efreet_menu_entry_new();
|
||||
entry->type = EFREET_MENU_ENTRY_DESKTOP;
|
||||
entry->id = ecore_string_instance(md->id);
|
||||
entry->name = ecore_string_instance(md->desktop->name);
|
||||
if (md->desktop->icon) entry->icon = ecore_string_instance(md->desktop->icon);
|
||||
entry->id = eina_stringshare_add(md->id);
|
||||
entry->name = eina_stringshare_add(md->desktop->name);
|
||||
if (md->desktop->icon) entry->icon = eina_stringshare_add(md->desktop->icon);
|
||||
efreet_desktop_ref(md->desktop);
|
||||
entry->desktop = md->desktop;
|
||||
|
||||
|
@ -3835,7 +3835,7 @@ efreet_menu_layout_entries_get(Efreet_Menu *entry, Efreet_Menu_Internal *interna
|
|||
Efreet_Menu *tmp;
|
||||
|
||||
tmp = ecore_list_first_remove(sub_entry->entries);
|
||||
ecore_string_release(tmp->name);
|
||||
eina_stringshare_del(tmp->name);
|
||||
tmp->name = sub_entry->name;
|
||||
sub_entry->name = NULL;
|
||||
IF_RELEASE(tmp->icon);
|
||||
|
|
|
@ -365,9 +365,9 @@ efreet_mime_load_globs(Ecore_List *datadirs, const char *datahome)
|
|||
|
||||
IF_FREE_HASH(wild);
|
||||
wild = ecore_hash_new(ecore_str_hash, ecore_str_compare);
|
||||
ecore_hash_free_key_cb_set(wild, ECORE_FREE_CB(ecore_string_release));
|
||||
ecore_hash_free_key_cb_set(wild, ECORE_FREE_CB(eina_stringshare_del));
|
||||
ecore_hash_free_value_cb_set(wild,
|
||||
ECORE_FREE_CB(ecore_string_release));
|
||||
ECORE_FREE_CB(eina_stringshare_del));
|
||||
IF_FREE_LIST(globs);
|
||||
globs = ecore_list_new();
|
||||
ecore_list_free_cb_set(globs, efreet_mime_glob_free);
|
||||
|
@ -688,8 +688,8 @@ efreet_mime_mime_types_load(const char *file)
|
|||
strncpy(ext, pp, (p - pp));
|
||||
ext[p - pp] = 0;
|
||||
|
||||
ecore_hash_set(wild, (void*)ecore_string_instance(ext),
|
||||
(void*)ecore_string_instance(mimetype));
|
||||
ecore_hash_set(wild, (void*)eina_stringshare_add(ext),
|
||||
(void*)eina_stringshare_add(mimetype));
|
||||
}
|
||||
while ((*p != '\n') && (*p != 0));
|
||||
}
|
||||
|
@ -746,16 +746,16 @@ efreet_mime_shared_mimeinfo_globs_load(const char *file)
|
|||
|
||||
if (ext[0] == '*' && ext[1] == '.')
|
||||
{
|
||||
ecore_hash_set(wild, (void*)ecore_string_instance(&(ext[2])),
|
||||
(void*)ecore_string_instance(mimetype));
|
||||
ecore_hash_set(wild, (void*)eina_stringshare_add(&(ext[2])),
|
||||
(void*)eina_stringshare_add(mimetype));
|
||||
}
|
||||
else
|
||||
{
|
||||
mime = NEW(Efreet_Mime_Glob, 1);
|
||||
if (mime)
|
||||
{
|
||||
mime->mime = ecore_string_instance(mimetype);
|
||||
mime->glob = ecore_string_instance(ext);
|
||||
mime->mime = eina_stringshare_add(mimetype);
|
||||
mime->glob = eina_stringshare_add(ext);
|
||||
if ((!mime->mime) || (!mime->glob))
|
||||
{
|
||||
IF_RELEASE(mime->mime);
|
||||
|
@ -901,7 +901,7 @@ efreet_mime_shared_mimeinfo_magic_parse(char *data, int size)
|
|||
memcpy(&buf, ptr, val - ptr);
|
||||
buf[val - ptr] = '\0';
|
||||
|
||||
mime->mime = ecore_string_instance(buf);
|
||||
mime->mime = eina_stringshare_add(buf);
|
||||
ptr = ++val;
|
||||
|
||||
while (*ptr != '\n') ptr++;
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include <Ecore.h>
|
||||
#include <Ecore_File.h>
|
||||
#include <Ecore_Str.h>
|
||||
#include <eina_stringshare.h>
|
||||
|
||||
#include "efreet_xml.h"
|
||||
#include "efreet_ini.h"
|
||||
|
@ -56,11 +57,11 @@
|
|||
|
||||
/**
|
||||
* @def IF_RELEASE(x)
|
||||
* If x is set, ecore_string_release x and set to NULL
|
||||
* If x is set, eina_stringshare_del x and set to NULL
|
||||
*/
|
||||
#define IF_RELEASE(x) do { \
|
||||
if (x) { \
|
||||
const char *__tmp; __tmp = (x); (x) = NULL; ecore_string_release(__tmp); \
|
||||
const char *__tmp; __tmp = (x); (x) = NULL; eina_stringshare_del(__tmp); \
|
||||
} \
|
||||
(x) = NULL; \
|
||||
} while (0)
|
||||
|
|
|
@ -44,7 +44,7 @@ efreet_trash_dir_get(void)
|
|||
return NULL;
|
||||
|
||||
IF_RELEASE(efreet_trash_dir);
|
||||
efreet_trash_dir = ecore_string_instance(buf);
|
||||
efreet_trash_dir = eina_stringshare_add(buf);
|
||||
|
||||
snprintf(buf, sizeof(buf), "%s/files", efreet_trash_dir);
|
||||
if (!ecore_file_exists(buf) && !ecore_file_mkpath(buf))
|
||||
|
|
|
@ -60,9 +60,9 @@ efreet_uri_decode(const char *full_uri)
|
|||
uri = NEW(Efreet_Uri, 1);
|
||||
if (!uri) return NULL;
|
||||
|
||||
uri->protocol = ecore_string_instance(protocol);
|
||||
uri->hostname = ecore_string_instance(hostname);
|
||||
uri->path = ecore_string_instance(path);
|
||||
uri->protocol = eina_stringshare_add(protocol);
|
||||
uri->hostname = eina_stringshare_add(hostname);
|
||||
uri->path = eina_stringshare_add(path);
|
||||
|
||||
return uri;
|
||||
}
|
||||
|
@ -71,7 +71,7 @@ efreet_uri_decode(const char *full_uri)
|
|||
* @param uri: Create an URI string from an Efreet_Uri struct
|
||||
* @return The string rapresentation of uri (ex: 'file:///home/my%20name')
|
||||
* @brief Get the string rapresentation of the given uri struct escaping
|
||||
* illegal caracters. Remember to free the string with ecore_string_release()
|
||||
* illegal caracters. Remember to free the string with eina_stringshare_del()
|
||||
* when you don't need it anymore.
|
||||
* @note The resulting string will contain the protocol and the path but not
|
||||
* the hostname, as many apps doesn't handle it.
|
||||
|
@ -99,7 +99,7 @@ efreet_uri_encode(Efreet_Uri *uri)
|
|||
}
|
||||
}
|
||||
|
||||
return ecore_string_instance(dest);
|
||||
return eina_stringshare_add(dest);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -107,15 +107,15 @@ efreet_util_init(void)
|
|||
if (!EFREET_EVENT_DESKTOP_CHANGE)
|
||||
EFREET_EVENT_DESKTOP_CHANGE = ecore_event_type_new();
|
||||
desktop_by_file_id = ecore_hash_new(ecore_str_hash, ecore_str_compare);
|
||||
ecore_hash_free_key_cb_set(desktop_by_file_id, ECORE_FREE_CB(ecore_string_release));
|
||||
ecore_hash_free_key_cb_set(desktop_by_file_id, ECORE_FREE_CB(eina_stringshare_del));
|
||||
ecore_hash_free_value_cb_set(desktop_by_file_id, ECORE_FREE_CB(efreet_util_desktop_free));
|
||||
|
||||
file_id_by_desktop_path = ecore_hash_new(ecore_str_hash, ecore_str_compare);
|
||||
ecore_hash_free_key_cb_set(file_id_by_desktop_path, ECORE_FREE_CB(ecore_string_release));
|
||||
ecore_hash_free_value_cb_set(file_id_by_desktop_path, ECORE_FREE_CB(ecore_string_release));
|
||||
ecore_hash_free_key_cb_set(file_id_by_desktop_path, ECORE_FREE_CB(eina_stringshare_del));
|
||||
ecore_hash_free_value_cb_set(file_id_by_desktop_path, ECORE_FREE_CB(eina_stringshare_del));
|
||||
|
||||
desktops_by_category = ecore_hash_new(ecore_str_hash, ecore_str_compare);
|
||||
ecore_hash_free_key_cb_set(desktops_by_category, ECORE_FREE_CB(ecore_string_release));
|
||||
ecore_hash_free_key_cb_set(desktops_by_category, ECORE_FREE_CB(eina_stringshare_del));
|
||||
ecore_hash_free_value_cb_set(desktops_by_category, ECORE_FREE_CB(ecore_list_destroy));
|
||||
|
||||
monitors = ecore_list_new();
|
||||
|
@ -232,9 +232,9 @@ efreet_util_path_to_file_id(const char *path)
|
|||
p++;
|
||||
}
|
||||
free(base);
|
||||
file_id = ecore_string_instance(tmp);
|
||||
file_id = eina_stringshare_add(tmp);
|
||||
free(tmp);
|
||||
ecore_hash_set(file_id_by_desktop_path, (void *)ecore_string_instance(path),
|
||||
ecore_hash_set(file_id_by_desktop_path, (void *)eina_stringshare_add(path),
|
||||
(void *)file_id);
|
||||
return file_id;
|
||||
}
|
||||
|
@ -245,10 +245,10 @@ efreet_util_desktop_mime_list(const char *mime)
|
|||
Efreet_Cache_Search_List search;
|
||||
|
||||
search.list = ecore_list_new();
|
||||
search.what = ecore_string_instance(mime);
|
||||
search.what = eina_stringshare_add(mime);
|
||||
|
||||
ecore_hash_for_each_node(desktop_by_file_id, efreet_util_cache_search_mime, &search);
|
||||
ecore_string_release(search.what);
|
||||
eina_stringshare_del(search.what);
|
||||
|
||||
if (ecore_list_empty_is(search.list)) IF_FREE_LIST(search.list);
|
||||
return search.list;
|
||||
|
@ -315,7 +315,7 @@ efreet_util_desktop_file_id_find(const char *file_id)
|
|||
ud->priority = priority;
|
||||
ud->desktop = desktop;
|
||||
|
||||
ecore_hash_set(desktop_by_file_id, (void *)ecore_string_instance(file_id), ud);
|
||||
ecore_hash_set(desktop_by_file_id, (void *)eina_stringshare_add(file_id), ud);
|
||||
efreet_util_desktops_by_category_add(desktop);
|
||||
|
||||
ev = NEW(Efreet_Event_Desktop_Change, 1);
|
||||
|
@ -569,8 +569,8 @@ efreet_util_cache_add(const char *path, const char *file_id, int priority, int e
|
|||
|
||||
if (!ecore_hash_get(file_id_by_desktop_path, desktop->orig_path))
|
||||
ecore_hash_set(file_id_by_desktop_path,
|
||||
(void *)ecore_string_instance(desktop->orig_path),
|
||||
(void *)ecore_string_instance(file_id));
|
||||
(void *)eina_stringshare_add(desktop->orig_path),
|
||||
(void *)eina_stringshare_add(file_id));
|
||||
|
||||
ud = ecore_hash_get(desktop_by_file_id, file_id);
|
||||
if (!ud)
|
||||
|
@ -579,7 +579,7 @@ efreet_util_cache_add(const char *path, const char *file_id, int priority, int e
|
|||
ud->priority = priority;
|
||||
ud->desktop = desktop;
|
||||
|
||||
ecore_hash_set(desktop_by_file_id, (void *)ecore_string_instance(file_id), ud);
|
||||
ecore_hash_set(desktop_by_file_id, (void *)eina_stringshare_add(file_id), ud);
|
||||
efreet_util_desktops_by_category_add(desktop);
|
||||
|
||||
if (event)
|
||||
|
@ -703,7 +703,7 @@ efreet_util_cache_reload(const char *path, const char *file_id, int priority)
|
|||
ud->priority = priority;
|
||||
ud->desktop = desktop;
|
||||
|
||||
ecore_hash_set(desktop_by_file_id, (void *)ecore_string_instance(file_id), ud);
|
||||
ecore_hash_set(desktop_by_file_id, (void *)eina_stringshare_add(file_id), ud);
|
||||
efreet_util_desktops_by_category_remove(ud->desktop);
|
||||
efreet_util_desktops_by_category_add(desktop);
|
||||
|
||||
|
@ -1049,7 +1049,7 @@ efreet_util_desktops_by_category_add(Efreet_Desktop *desktop)
|
|||
{
|
||||
list = ecore_list_new();
|
||||
ecore_hash_set(desktops_by_category,
|
||||
(void *)ecore_string_instance(category), list);
|
||||
(void *)eina_stringshare_add(category), list);
|
||||
}
|
||||
if (!ecore_list_goto(list, desktop))
|
||||
ecore_list_append(list, desktop);
|
||||
|
|
|
@ -28,7 +28,7 @@ int
|
|||
efreet_xml_init(void)
|
||||
{
|
||||
if (init++) return init;
|
||||
if (!ecore_string_init()) return --init;
|
||||
if (!eina_stringshare_init()) return --init;
|
||||
return init;
|
||||
}
|
||||
|
||||
|
@ -41,7 +41,7 @@ int
|
|||
efreet_xml_shutdown(void)
|
||||
{
|
||||
if (--init) return init;
|
||||
ecore_string_shutdown();
|
||||
eina_stringshare_shutdown();
|
||||
return init;
|
||||
}
|
||||
|
||||
|
@ -98,7 +98,7 @@ efreet_xml_del(Efreet_Xml *xml)
|
|||
if (xml->children) ecore_dlist_destroy(xml->children);
|
||||
xml->children = NULL;
|
||||
|
||||
if (xml->tag) ecore_string_release(xml->tag);
|
||||
if (xml->tag) eina_stringshare_del(xml->tag);
|
||||
if (xml->attributes)
|
||||
{
|
||||
Efreet_Xml_Attribute **curr;
|
||||
|
@ -106,8 +106,8 @@ efreet_xml_del(Efreet_Xml *xml)
|
|||
curr = xml->attributes;
|
||||
while (*curr)
|
||||
{
|
||||
ecore_string_release((*curr)->key);
|
||||
ecore_string_release((*curr)->value);
|
||||
eina_stringshare_del((*curr)->key);
|
||||
eina_stringshare_del((*curr)->value);
|
||||
|
||||
FREE(*curr);
|
||||
curr++;
|
||||
|
@ -192,7 +192,7 @@ efreet_xml_parse(char **data, int *size)
|
|||
xml = NEW(Efreet_Xml, 1);
|
||||
if (!xml)
|
||||
{
|
||||
ecore_string_release(tag);
|
||||
eina_stringshare_del(tag);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -291,7 +291,7 @@ efreet_xml_tag_parse(char **data, int *size, const char **tag)
|
|||
if (buf_size > 256) buf_size = 256;
|
||||
memcpy(buf, start, buf_size - 1);
|
||||
buf[buf_size - 1] = '\0';
|
||||
*tag = ecore_string_instance(buf);
|
||||
*tag = eina_stringshare_add(buf);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
@ -339,7 +339,7 @@ efreet_xml_attributes_parse(char **data, int *size,
|
|||
if (buf_size > 256) buf_size = 256;
|
||||
memcpy(buf, start, buf_size - 1);
|
||||
buf[buf_size - 1] = '\0';
|
||||
attr[count].key = ecore_string_instance(buf);
|
||||
attr[count].key = eina_stringshare_add(buf);
|
||||
|
||||
/* search for '=', key/value seperator */
|
||||
start = NULL;
|
||||
|
@ -413,7 +413,7 @@ efreet_xml_attributes_parse(char **data, int *size,
|
|||
if (buf_size > 256) buf_size = 256;
|
||||
memcpy(buf, start, buf_size - 1);
|
||||
buf[buf_size - 1] = '\0';
|
||||
attr[count].value = ecore_string_instance(buf);
|
||||
attr[count].value = eina_stringshare_add(buf);
|
||||
|
||||
count++;
|
||||
}
|
||||
|
@ -434,8 +434,8 @@ efreet_xml_attributes_parse(char **data, int *size,
|
|||
ERROR:
|
||||
while (count >= 0)
|
||||
{
|
||||
if (attr[count].key) ecore_string_release(attr[count].key);
|
||||
if (attr[count].value) ecore_string_release(attr[count].value);
|
||||
if (attr[count].key) eina_stringshare_del(attr[count].key);
|
||||
if (attr[count].value) eina_stringshare_del(attr[count].value);
|
||||
count--;
|
||||
}
|
||||
error = 1;
|
||||
|
|
Loading…
Reference in New Issue