parent
ddb11ee846
commit
908a722bfa
|
@ -39,8 +39,8 @@ efreet_base_shutdown(void)
|
|||
IF_RELEASE(xdg_config_home);
|
||||
IF_RELEASE(xdg_cache_home);
|
||||
|
||||
IF_FREE_LIST(xdg_data_dirs);
|
||||
IF_FREE_LIST(xdg_config_dirs);
|
||||
IF_FREE_LIST(xdg_data_dirs, eina_stringshare_del);
|
||||
IF_FREE_LIST(xdg_config_dirs, eina_stringshare_del);
|
||||
|
||||
eina_stringshare_shutdown();
|
||||
}
|
||||
|
|
|
@ -371,8 +371,8 @@ efreet_desktop_clear(Efreet_Desktop *desktop)
|
|||
IF_FREE(desktop->path);
|
||||
IF_FREE(desktop->startup_wm_class);
|
||||
|
||||
IF_FREE_LIST(desktop->only_show_in);
|
||||
IF_FREE_LIST(desktop->not_show_in);
|
||||
IF_FREE_LIST(desktop->only_show_in, free);
|
||||
IF_FREE_LIST(desktop->not_show_in, free);
|
||||
while (desktop->categories)
|
||||
{
|
||||
data = eina_list_data_get(desktop->categories);
|
||||
|
@ -511,8 +511,8 @@ efreet_desktop_free(Efreet_Desktop *desktop)
|
|||
IF_FREE(desktop->path);
|
||||
IF_FREE(desktop->startup_wm_class);
|
||||
|
||||
IF_FREE_LIST(desktop->only_show_in);
|
||||
IF_FREE_LIST(desktop->not_show_in);
|
||||
IF_FREE_LIST(desktop->only_show_in, free);
|
||||
IF_FREE_LIST(desktop->not_show_in, free);
|
||||
|
||||
EINA_LIST_FREE(desktop->categories, str)
|
||||
eina_stringshare_del(str);
|
||||
|
|
|
@ -140,9 +140,9 @@ efreet_icon_shutdown(void)
|
|||
IF_FREE(efreet_icon_user_dir);
|
||||
IF_FREE(efreet_icon_deprecated_user_dir);
|
||||
|
||||
EINA_LIST_FREE(efreet_icon_extensions, d) free(d);
|
||||
IF_FREE_LIST(efreet_icon_extensions, free);
|
||||
IF_FREE_HASH(efreet_icon_themes);
|
||||
IF_FREE_LIST(efreet_extra_icon_dirs);
|
||||
efreet_extra_icon_dirs = eina_list_free(efreet_extra_icon_dirs);
|
||||
|
||||
IF_FREE_HASH(efreet_icon_cache);
|
||||
|
||||
|
@ -990,7 +990,7 @@ efreet_icon_free(Efreet_Icon *icon)
|
|||
|
||||
IF_FREE(icon->path);
|
||||
IF_FREE(icon->name);
|
||||
IF_FREE_LIST(icon->attach_points);
|
||||
IF_FREE_LIST(icon->attach_points, free);
|
||||
|
||||
FREE(icon);
|
||||
}
|
||||
|
@ -1126,9 +1126,9 @@ efreet_icon_theme_free(Efreet_Icon_Theme *theme)
|
|||
IF_FREE(theme->comment);
|
||||
IF_FREE(theme->example_icon);
|
||||
|
||||
EINA_LIST_FREE(theme->paths, d) free(d);
|
||||
EINA_LIST_FREE(theme->inherits, d) free(d);
|
||||
EINA_LIST_FREE(theme->directories, d) efreet_icon_theme_directory_free(d);
|
||||
IF_FREE_LIST(theme->paths, free);
|
||||
IF_FREE_LIST(theme->inherits, free);
|
||||
IF_FREE_LIST(theme->directories, efreet_icon_theme_directory_free);
|
||||
|
||||
FREE(theme);
|
||||
}
|
||||
|
@ -1501,11 +1501,19 @@ efreet_icon_theme_directory_new(Efreet_Ini *ini, const char *name)
|
|||
return dir;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* @param dir: The Efreet_Icon_Theme_Directory to free
|
||||
* @return Returns no value
|
||||
* @brief Frees the given directory @a dir
|
||||
*/
|
||||
static void
|
||||
efreet_icon_theme_directory_free(Efreet_Icon_Theme_Directory *dir)
|
||||
{
|
||||
free(dir->name);
|
||||
free(dir);
|
||||
if (!dir) return;
|
||||
|
||||
IF_FREE(dir->name);
|
||||
FREE(dir);
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
|
@ -289,6 +289,7 @@ static Efreet_Menu_Filter *efreet_menu_filter_new(void);
|
|||
static void efreet_menu_filter_free(Efreet_Menu_Filter *filter);
|
||||
|
||||
static Efreet_Menu_Layout *efreet_menu_layout_new(void);
|
||||
static void efreet_menu_layout_free(Efreet_Menu_Layout *layout);
|
||||
|
||||
static Efreet_Menu_Filter_Op *efreet_menu_filter_op_new(void);
|
||||
static void efreet_menu_filter_op_free(Efreet_Menu_Filter_Op *op);
|
||||
|
@ -501,7 +502,7 @@ efreet_menu_kde_legacy_init(void)
|
|||
char buf[PATH_MAX];
|
||||
char *p, *s;
|
||||
|
||||
IF_FREE_LIST(efreet_menu_kde_legacy_dirs);
|
||||
IF_FREE_LIST(efreet_menu_kde_legacy_dirs, eina_stringshare_del);
|
||||
|
||||
f = popen("kde-config --path apps", "r");
|
||||
if (!f) return 0;
|
||||
|
@ -548,7 +549,7 @@ efreet_menu_shutdown(void)
|
|||
IF_FREE_HASH(efreet_menu_move_cbs);
|
||||
IF_FREE_HASH(efreet_menu_layout_cbs);
|
||||
|
||||
IF_FREE_LIST(efreet_menu_kde_legacy_dirs);
|
||||
IF_FREE_LIST(efreet_menu_kde_legacy_dirs, eina_stringshare_del);
|
||||
|
||||
IF_FREE_HASH(efreet_merged_menus);
|
||||
IF_FREE_HASH(efreet_merged_dirs);
|
||||
|
@ -998,22 +999,21 @@ efreet_menu_internal_free(Efreet_Menu_Internal *internal)
|
|||
IF_RELEASE(internal->name.internal);
|
||||
internal->name.name = NULL;
|
||||
|
||||
IF_FREE_LIST(internal->applications);
|
||||
internal->applications = eina_list_free(internal->applications);
|
||||
|
||||
IF_FREE_DLIST(internal->directories);
|
||||
EINA_LIST_FREE(internal->app_dirs, d) efreet_menu_app_dir_free(d);
|
||||
// IF_FREE_LIST(internal->app_dirs);
|
||||
IF_FREE_LIST(internal->app_pool);
|
||||
IF_FREE_LIST(internal->app_dirs, efreet_menu_app_dir_free);
|
||||
IF_FREE_LIST(internal->app_pool, efreet_menu_desktop_free);
|
||||
IF_FREE_DLIST(internal->directory_dirs);
|
||||
IF_FREE_HASH(internal->directory_cache);
|
||||
|
||||
IF_FREE_LIST(internal->moves);
|
||||
IF_FREE_LIST(internal->filters);
|
||||
IF_FREE_LIST(internal->moves, efreet_menu_move_free);
|
||||
IF_FREE_LIST(internal->filters, efreet_menu_filter_free);
|
||||
|
||||
IF_FREE_LIST(internal->sub_menus);
|
||||
IF_FREE_LIST(internal->sub_menus, efreet_menu_internal_free);
|
||||
|
||||
IF_FREE_LIST(internal->layout);
|
||||
IF_FREE_LIST(internal->default_layout);
|
||||
IF_FREE_LIST(internal->layout, efreet_menu_layout_free);
|
||||
IF_FREE_LIST(internal->default_layout, efreet_menu_layout_free);
|
||||
|
||||
FREE(internal);
|
||||
}
|
||||
|
@ -2434,6 +2434,21 @@ efreet_menu_layout_new(void)
|
|||
return layout;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* @param filter: The filter to work with
|
||||
* @return Returns no data
|
||||
* @brief Frees the given filter and all data
|
||||
*/
|
||||
static void
|
||||
efreet_menu_layout_free(Efreet_Menu_Layout *layout)
|
||||
{
|
||||
if (!layout) return;
|
||||
|
||||
IF_FREE(layout->name);
|
||||
FREE(layout);
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* @return Returns a new Efreet_Menu_Filter_Op on success or NULL on failure
|
||||
|
@ -2460,9 +2475,9 @@ efreet_menu_filter_op_free(Efreet_Menu_Filter_Op *op)
|
|||
{
|
||||
if (!op) return;
|
||||
|
||||
IF_FREE_LIST(op->categories);
|
||||
IF_FREE_LIST(op->filenames);
|
||||
IF_FREE_LIST(op->filters);
|
||||
IF_FREE_LIST(op->categories, free);
|
||||
IF_FREE_LIST(op->filenames, free);
|
||||
IF_FREE_LIST(op->filters, efreet_menu_filter_op_free);
|
||||
|
||||
FREE(op);
|
||||
}
|
||||
|
@ -2522,7 +2537,7 @@ efreet_menu_free(Efreet_Menu *entry)
|
|||
{
|
||||
IF_RELEASE(entry->name);
|
||||
IF_RELEASE(entry->icon);
|
||||
IF_FREE_LIST(entry->entries);
|
||||
entry->entries = eina_list_free(entry->entries);
|
||||
IF_RELEASE(entry->id);
|
||||
if (entry->desktop) efreet_desktop_free(entry->desktop);
|
||||
FREE(entry);
|
||||
|
@ -3088,7 +3103,7 @@ efreet_menu_resolve_moves(Efreet_Menu_Internal *internal)
|
|||
efreet_menu_internal_free(origin);
|
||||
}
|
||||
}
|
||||
IF_FREE_LIST(internal->moves);
|
||||
IF_FREE_LIST(internal->moves, efreet_menu_move_free);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -3207,12 +3222,20 @@ efreet_menu_app_dir_new(void)
|
|||
return dir;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* @param dir: The Efreet_Menu_App_Dir to free
|
||||
* @return Returns no value.
|
||||
* @brief Frees the given dir structure
|
||||
*/
|
||||
static void
|
||||
efreet_menu_app_dir_free(Efreet_Menu_App_Dir *dir)
|
||||
{
|
||||
free(dir->path);
|
||||
free(dir->prefix);
|
||||
free(dir);
|
||||
if (!dir) return;
|
||||
|
||||
IF_FREE(dir->path);
|
||||
IF_FREE(dir->prefix);
|
||||
FREE(dir);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -3783,7 +3806,7 @@ efreet_menu_layout_entries_get(Efreet_Menu *entry, Efreet_Menu_Internal *interna
|
|||
entry->entries = eina_list_append(entry->entries, sub_entry);
|
||||
}
|
||||
}
|
||||
IF_FREE_LIST(internal->applications);
|
||||
internal->applications = eina_list_free(internal->applications);
|
||||
}
|
||||
else if (internal->sub_menus && !strcmp(layout->name, "menus"))
|
||||
{
|
||||
|
@ -3861,7 +3884,7 @@ efreet_menu_layout_entries_get(Efreet_Menu *entry, Efreet_Menu_Internal *interna
|
|||
}
|
||||
efreet_menu_internal_free(sub);
|
||||
}
|
||||
IF_FREE_LIST(internal->sub_menus);
|
||||
IF_FREE_LIST(internal->sub_menus, efreet_menu_internal_free);
|
||||
}
|
||||
else if (internal->sub_menus && !strcmp(layout->name, "all"))
|
||||
{
|
||||
|
|
|
@ -196,8 +196,8 @@ efreet_mime_shutdown(void)
|
|||
|
||||
efreet_mime_icons_debug();
|
||||
|
||||
EINA_LIST_FREE(globs, d) efreet_mime_glob_free(d);
|
||||
EINA_LIST_FREE(magics, d) efreet_mime_magic_free(d);
|
||||
IF_FREE_LIST(globs, efreet_mime_glob_free);
|
||||
IF_FREE_LIST(magics, efreet_mime_magic_free);
|
||||
IF_FREE_HASH(monitors);
|
||||
IF_FREE_HASH(wild);
|
||||
IF_FREE_HASH(mime_icons);
|
||||
|
@ -1015,7 +1015,7 @@ efreet_mime_shared_mimeinfo_magic_parse(char *data, int size)
|
|||
{
|
||||
if (!(entry = NEW(Efreet_Mime_Magic_Entry, 1)))
|
||||
{
|
||||
IF_FREE_LIST(magics);
|
||||
IF_FREE_LIST(magics, efreet_mime_magic_free);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -70,8 +70,12 @@
|
|||
* @def IF_FREE_LIST(x)
|
||||
* If x is a valid pointer destroy x and set to NULL
|
||||
*/
|
||||
#define IF_FREE_LIST(x) do { \
|
||||
x = eina_list_free(x); \
|
||||
#define IF_FREE_LIST(list, free_cb) do { \
|
||||
while (list) \
|
||||
{ \
|
||||
free_cb(eina_list_data_get(list)); \
|
||||
list = eina_list_remove_list(list, list); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue