diff options
Diffstat (limited to 'src/bin')
32 files changed, 689 insertions, 608 deletions
diff --git a/src/bin/e_actions.c b/src/bin/e_actions.c index aceef84c5e..fac7f814e7 100644 --- a/src/bin/e_actions.c +++ b/src/bin/e_actions.c @@ -2256,7 +2256,7 @@ ACT_FN_END_MOUSE(delayed_action) } /* local subsystem globals */ -static Evas_Hash *actions = NULL; +static Eina_Hash *actions = NULL; static Eina_List *action_list = NULL; static Eina_List *action_names = NULL; static Eina_List *action_groups = NULL; @@ -2268,8 +2268,9 @@ e_actions_init(void) { E_Action *act; + actions = eina_hash_string_superfast_new(NULL); ACT_GO(window_move); - e_action_predef_name_set(_("Window : Actions"), _("Move"), + e_action_predef_name_set(_("Window : Actions"), _("Move"), "window_move", NULL, NULL, 0); ACT_GO_MOUSE(window_move); @@ -2655,7 +2656,7 @@ e_actions_shutdown(void) { e_action_predef_name_all_del(); action_names = eina_list_free(action_names); - evas_hash_free(actions); + eina_hash_free(actions); actions = NULL; E_FREE_LIST(action_list, e_object_del); @@ -2672,14 +2673,14 @@ EAPI E_Action * e_action_add(const char *name) { E_Action *act; - + act = e_action_find(name); if (!act) { act = E_OBJECT_ALLOC(E_Action, E_ACTION_TYPE, _e_action_free); if (!act) return NULL; act->name = name; - actions = evas_hash_direct_add(actions, act->name, act); + eina_hash_direct_add(actions, act->name, act); action_names = eina_list_append(action_names, name); action_list = eina_list_append(action_list, act); } @@ -2691,7 +2692,7 @@ e_action_del(const char *name) { E_Action *act; - act = evas_hash_find(actions, name); + act = eina_hash_find(actions, name); if (act) _e_action_free(act); } @@ -2700,8 +2701,7 @@ EAPI E_Action * e_action_find(const char *name) { E_Action *act; - - act = evas_hash_find(actions, name); + act = eina_hash_find(actions, name); return act; } @@ -2870,7 +2870,7 @@ e_action_groups_get(void) static void _e_action_free(E_Action *act) { - actions = evas_hash_del(actions, act->name, act); + eina_hash_del(actions, act->name, act); action_names = eina_list_remove(action_names, act->name); action_list = eina_list_remove(action_list, act); free(act); diff --git a/src/bin/e_border.c b/src/bin/e_border.c index 78d0e8eb06..cf81787e77 100644 --- a/src/bin/e_border.c +++ b/src/bin/e_border.c @@ -107,7 +107,7 @@ static void _e_border_hook_call(E_Border_Hook_Point hookpoint, E_Border *bd); /* local subsystem globals */ static Eina_List *handlers = NULL; static Eina_List *borders = NULL; -static Evas_Hash *borders_hash = NULL; +static Eina_Hash *borders_hash = NULL; static E_Border *focused = NULL; static E_Border *resize = NULL; @@ -183,12 +183,12 @@ e_border_init(void) ecore_x_passive_grab_replay_func_set(_e_border_cb_grab_replay, NULL); handlers = eina_list_append(handlers, ecore_event_handler_add(E_EVENT_POINTER_WARP, _e_border_cb_pointer_warp, NULL)); - handlers = eina_list_append(handlers, ecore_event_handler_add(EFREET_EVENT_DESKTOP_LIST_CHANGE, _e_border_cb_efreet_desktop_list_change, NULL)); handlers = eina_list_append(handlers, ecore_event_handler_add(EFREET_EVENT_DESKTOP_CHANGE, _e_border_cb_efreet_desktop_change, NULL)); - handlers = eina_list_append(handlers, ecore_event_handler_add(E_EVENT_CONFIG_ICON_THEME, _e_border_cb_config_icon_theme, NULL)); + if (!borders_hash) borders_hash = eina_hash_string_superfast_new(NULL); + E_EVENT_BORDER_ADD = ecore_event_type_new(); E_EVENT_BORDER_REMOVE = ecore_event_type_new(); E_EVENT_BORDER_DESK_SET = ecore_event_type_new(); @@ -218,6 +218,9 @@ e_border_shutdown(void) { E_FREE_LIST(handlers, ecore_event_handler_del); + if (borders_hash) eina_hash_free(borders_hash); + borders_hash = NULL; + return 1; } @@ -471,7 +474,7 @@ e_border_new(E_Container *con, Ecore_X_Window win, int first_map, int internal) */ /* ecore_x_window_reparent(win, bd->client.shell_win, 0, 0); */ bd->need_reparent = 1; - + ecore_x_window_border_width_set(win, 0); ecore_x_window_show(bd->event_win); ecore_x_window_show(bd->client.shell_win); @@ -486,7 +489,7 @@ e_border_new(E_Container *con, Ecore_X_Window win, int first_map, int internal) bd->desk = e_desk_current_get(bd->zone); e_container_border_add(bd); borders = eina_list_append(borders, bd); - bd2 = evas_hash_find(borders_hash, e_util_winid_str_get(bd->client.win)); + bd2 = eina_hash_find(borders_hash, e_util_winid_str_get(bd->client.win)); if (bd2) { printf("EEEEK! 2 borders with same client window id in them! very bad!\n"); @@ -495,13 +498,13 @@ e_border_new(E_Container *con, Ecore_X_Window win, int first_map, int internal) printf("bd=%p, bd->references=%i, bd->deleted=%i, bd->client.win=%x\n", bd2, bd2->e_obj_inherit.references, bd2->e_obj_inherit.deleted, bd2->client.win); - borders_hash = evas_hash_del(borders_hash, e_util_winid_str_get(bd->client.win), bd2); - borders_hash = evas_hash_del(borders_hash, e_util_winid_str_get(bd2->bg_win), bd2); - borders_hash = evas_hash_del(borders_hash, e_util_winid_str_get(bd2->win), bd2); + eina_hash_del(borders_hash, e_util_winid_str_get(bd->client.win), bd2); + eina_hash_del(borders_hash, e_util_winid_str_get(bd2->bg_win), bd2); + eina_hash_del(borders_hash, e_util_winid_str_get(bd2->win), bd2); } - borders_hash = evas_hash_add(borders_hash, e_util_winid_str_get(bd->client.win), bd); - borders_hash = evas_hash_add(borders_hash, e_util_winid_str_get(bd->bg_win), bd); - borders_hash = evas_hash_add(borders_hash, e_util_winid_str_get(bd->win), bd); + eina_hash_add(borders_hash, e_util_winid_str_get(bd->client.win), bd); + eina_hash_add(borders_hash, e_util_winid_str_get(bd->bg_win), bd); + eina_hash_add(borders_hash, e_util_winid_str_get(bd->win), bd); managed = 1; ecore_x_window_prop_card32_set(win, E_ATOM_MANAGED, &managed, 1); ecore_x_window_prop_card32_set(win, E_ATOM_CONTAINER, &bd->zone->container->num, 1); @@ -2401,40 +2404,40 @@ e_border_unstick(E_Border *bd) } EAPI void -e_border_pinned_set(E_Border *bd, int set) +e_border_pinned_set(E_Border *bd, int set) { int layer; - int stacking; - - if (bd) - { - bd->borderless = set; - bd->user_skip_winlist = set; - if (set) - { + int stacking; + + if (bd) + { + bd->borderless = set; + bd->user_skip_winlist = set; + if (set) + { layer = 50; stacking = E_STACKING_BELOW; - } - else - { + } + else + { layer = 100; stacking = E_STACKING_NONE; - } - - e_border_layer_set(bd, layer); - e_hints_window_stacking_set(bd, stacking); + } - bd->client.border.changed = 1; - bd->changed = 1; - } -} + e_border_layer_set(bd, layer); + e_hints_window_stacking_set(bd, stacking); + + bd->client.border.changed = 1; + bd->changed = 1; + } +} EAPI E_Border * e_border_find_by_client_window(Ecore_X_Window win) { E_Border *bd; - - bd = evas_hash_find(borders_hash, e_util_winid_str_get(win)); + + bd = eina_hash_find(borders_hash, e_util_winid_str_get(win)); if ((bd) && (!e_object_is_del(E_OBJECT(bd))) && (bd->client.win == win)) return bd; @@ -2445,8 +2448,8 @@ EAPI E_Border * e_border_find_all_by_client_window(Ecore_X_Window win) { E_Border *bd; - - bd = evas_hash_find(borders_hash, e_util_winid_str_get(win)); + + bd = eina_hash_find(borders_hash, e_util_winid_str_get(win)); if ((bd) && (bd->client.win == win)) return bd; return NULL; @@ -2456,8 +2459,8 @@ EAPI E_Border * e_border_find_by_frame_window(Ecore_X_Window win) { E_Border *bd; - - bd = evas_hash_find(borders_hash, e_util_winid_str_get(win)); + + bd = eina_hash_find(borders_hash, e_util_winid_str_get(win)); if ((bd) && (!e_object_is_del(E_OBJECT(bd))) && (bd->bg_win == win)) return bd; @@ -2468,8 +2471,8 @@ EAPI E_Border * e_border_find_by_window(Ecore_X_Window win) { E_Border *bd; - - bd = evas_hash_find(borders_hash, e_util_winid_str_get(win)); + + bd = eina_hash_find(borders_hash, e_util_winid_str_get(win)); if ((bd) && (!e_object_is_del(E_OBJECT(bd))) && (bd->win == win)) return bd; @@ -3709,13 +3712,13 @@ _e_border_free(E_Border *bd) e_bindings_wheel_ungrab(E_BINDING_CONTEXT_BORDER, bd->win); ecore_x_window_del(bd->win); - borders_hash = evas_hash_del(borders_hash, e_util_winid_str_get(bd->client.win), bd); - borders_hash = evas_hash_del(borders_hash, e_util_winid_str_get(bd->bg_win), bd); - borders_hash = evas_hash_del(borders_hash, e_util_winid_str_get(bd->win), bd); + eina_hash_del(borders_hash, e_util_winid_str_get(bd->client.win), bd); + eina_hash_del(borders_hash, e_util_winid_str_get(bd->bg_win), bd); + eina_hash_del(borders_hash, e_util_winid_str_get(bd->win), bd); borders = eina_list_remove(borders, bd); focus_stack = eina_list_remove(focus_stack, bd); raise_stack = eina_list_remove(raise_stack, bd); - + e_container_border_remove(bd); free(bd); } diff --git a/src/bin/e_config_data.c b/src/bin/e_config_data.c index b2eee670dd..d15699b7f5 100644 --- a/src/bin/e_config_data.c +++ b/src/bin/e_config_data.c @@ -17,11 +17,11 @@ e_config_descriptor_new(const char *name, int size) eddc.func.list_append = (void *(*)(void *l, void *d)) eina_list_append; eddc.func.list_data = (void *(*)(void *)) eina_list_data_get; eddc.func.list_free = (void *(*)(void *)) eina_list_free; - eddc.func.hash_foreach = - (void (*) (void *, int (*) (void *, const char *, void *, void *), void *)) - evas_hash_foreach; - eddc.func.hash_add = (void *(*) (void *, const char *, void *)) evas_hash_add; - eddc.func.hash_free = (void (*) (void *)) evas_hash_free; + eddc.func.hash_foreach = + (void (*) (const Eina_Hash *, Eina_Bool (*) (const Eina_Hash *, const void *, void *, void *), const void *)) + eina_hash_foreach; + eddc.func.hash_add = (Eina_Hash* (*) (Eina_Hash *, const void *, void *)) eet_eina_hash_add_alloc; + eddc.func.hash_free = (void (*) (Eina_Hash *)) eina_hash_free; eddc.name = name; eddc.size = size; return (E_Config_DD *)eet_data_descriptor2_new(&eddc); diff --git a/src/bin/e_config_data.h b/src/bin/e_config_data.h index d27e4f8264..0a38dea022 100644 --- a/src/bin/e_config_data.h +++ b/src/bin/e_config_data.h @@ -29,6 +29,15 @@ typedef Eet_Data_Descriptor E_Config_DD; #ifndef E_CONFIG_DATA_H #define E_CONFIG_DATA_H +static inline Eina_Hash * +eet_eina_hash_add_alloc(Eina_Hash *hash, const void *key, void *data) +{ + if (!hash) hash = eina_hash_string_superfast_new(NULL); + if (!hash) return NULL; + eina_hash_add(hash, key, data); + return hash; +} + EAPI E_Config_DD *e_config_descriptor_new(const char *name, int size); #endif diff --git a/src/bin/e_configure.c b/src/bin/e_configure.c index 3b24f98560..1179b23afd 100644 --- a/src/bin/e_configure.c +++ b/src/bin/e_configure.c @@ -92,11 +92,11 @@ _e_configure_efreet_desktop_update(void) label = NULL; if (desktop->x) { - cfg_cat_cfg = ecore_hash_get(desktop->x, "X-Enlightenment-Config-Category"); - s = ecore_hash_get(desktop->x, "X-Enlightenment-Config-Priority"); + cfg_cat_cfg = eina_hash_find(desktop->x, "X-Enlightenment-Config-Category"); + s = eina_hash_find(desktop->x, "X-Enlightenment-Config-Priority"); if (s) cfg_pri = atoi(s); - cfg_cat_name = ecore_hash_get(desktop->x, "X-Enlightenment-Config-Category-Name"); - cfg_cat_icon = ecore_hash_get(desktop->x, "X-Enlightenment-Config-Category-Icon"); + cfg_cat_name = eina_hash_find(desktop->x, "X-Enlightenment-Config-Category-Name"); + cfg_cat_icon = eina_hash_find(desktop->x, "X-Enlightenment-Config-Category-Icon"); if (cfg_cat_icon) { if (cfg_cat_icon[0] == '/') diff --git a/src/bin/e_datastore.c b/src/bin/e_datastore.c index 7364a26843..d9676a239a 100644 --- a/src/bin/e_datastore.c +++ b/src/bin/e_datastore.c @@ -6,26 +6,30 @@ /* local subsystem functions */ /* local subsystem globals */ -static Evas_Hash *store = NULL; +static Eina_Hash *store = NULL; /* externally accessible functions */ EAPI void e_datastore_set(char *key, void *data) { - store = evas_hash_del(store, key, NULL); - store = evas_hash_add(store, key, data); + if (!store) store = eina_hash_string_superfast_new(NULL); + eina_hash_del(store, key, NULL); + eina_hash_add(store, key, data); } EAPI void * e_datastore_get(char *key) { - return evas_hash_find(store, key); + return eina_hash_find(store, key); } EAPI void e_datastore_del(char *key) { - store = evas_hash_del(store, key, NULL); + eina_hash_del(store, key, NULL); + if (eina_hash_population(store)) return; + eina_hash_free(store); + store = NULL; } /* local subsystem functions */ diff --git a/src/bin/e_dnd.c b/src/bin/e_dnd.c index b91cee8cb5..07311f4bdf 100644 --- a/src/bin/e_dnd.c +++ b/src/bin/e_dnd.c @@ -55,7 +55,7 @@ struct _XDnd static Eina_List *_event_handlers = NULL; static Eina_List *_drop_handlers = NULL; -static Evas_Hash *_drop_win_hash = NULL; +static Eina_Hash *_drop_win_hash = NULL; static Ecore_X_Window _drag_win = 0; static Ecore_X_Window _drag_win_root = 0; @@ -65,7 +65,7 @@ static E_Drag *_drag_current = NULL; static XDnd *_xdnd = NULL; -static Evas_Hash *_drop_handlers_responsives; +static Eina_Hash *_drop_handlers_responsives; static Ecore_X_Atom _action; /* externally accessible functions */ @@ -73,6 +73,9 @@ static Ecore_X_Atom _action; EAPI int e_dnd_init(void) { + _drop_win_hash = eina_hash_string_superfast_new(NULL); + _drop_handlers_responsives = eina_hash_string_superfast_new(NULL); + _event_handlers = eina_list_append(_event_handlers, ecore_event_handler_add(ECORE_X_EVENT_MOUSE_BUTTON_UP, _e_dnd_cb_mouse_up, NULL)); @@ -138,11 +141,11 @@ e_dnd_shutdown(void) eina_list_free(_event_handlers); _event_handlers = NULL; - evas_hash_free(_drop_win_hash); + eina_hash_free(_drop_win_hash); eina_list_free(_drop_handlers); _drop_handlers = NULL; - evas_hash_free(_drop_handlers_responsives); + eina_hash_free(_drop_handlers_responsives); return 1; } @@ -425,16 +428,16 @@ e_drop_xdnd_register_set(Ecore_X_Window win, int reg) id = e_util_winid_str_get(win); if (reg) { - if (!evas_hash_find(_drop_win_hash, id)) + if (!eina_hash_find(_drop_win_hash, id)) { ecore_x_dnd_aware_set(win, 1); - _drop_win_hash = evas_hash_add(_drop_win_hash, id, (void *)1); + eina_hash_add(_drop_win_hash, id, (void *)1); } } else { ecore_x_dnd_aware_set(win, 0); - _drop_win_hash = evas_hash_del(_drop_win_hash, id, (void *) 1); + eina_hash_del(_drop_win_hash, id, (void *) 1); } return 1; } @@ -514,7 +517,7 @@ e_drop_handler_responsive_set(E_Drop_Handler *handler) Ecore_X_Window hwin = _e_drag_win_get(handler, 1); const char *wid = e_util_winid_str_get(hwin); - _drop_handlers_responsives = evas_hash_add(_drop_handlers_responsives, wid, (void *)handler); + eina_hash_add(_drop_handlers_responsives, wid, (void *)handler); } EAPI int @@ -523,7 +526,7 @@ e_drop_handler_responsive_get(E_Drop_Handler *handler) Ecore_X_Window hwin = _e_drag_win_get(handler, 1); const char *wid = e_util_winid_str_get(hwin); - return evas_hash_find(_drop_handlers_responsives, wid) == (void *)handler; + return eina_hash_find(_drop_handlers_responsives, wid) == (void *)handler; } EAPI void @@ -1186,7 +1189,7 @@ _e_dnd_cb_event_dnd_enter(void *data, int type, void *event) ev = event; id = e_util_winid_str_get(ev->win); - if (!evas_hash_find(_drop_win_hash, id)) return 1; + if (!eina_hash_find(_drop_win_hash, id)) return 1; for (l = _drop_handlers; l; l = l->next) { E_Drop_Handler *h; @@ -1258,7 +1261,7 @@ _e_dnd_cb_event_dnd_leave(void *data, int type, void *event) ev = event; id = e_util_winid_str_get(ev->win); - if (!evas_hash_find(_drop_win_hash, id)) return 1; + if (!eina_hash_find(_drop_win_hash, id)) return 1; leave_ev.x = 0; leave_ev.y = 0; @@ -1304,7 +1307,7 @@ _e_dnd_cb_event_dnd_position(void *data, int type, void *event) ev = event; // double t1 = ecore_time_get(); //// id = e_util_winid_str_get(ev->win); - if (!evas_hash_find(_drop_win_hash, id)) + if (!eina_hash_find(_drop_win_hash, id)) { // double t2 = ecore_time_get() - t1; //// // printf("DND POS EV 1 %3.7f\n", t2); //// @@ -1396,7 +1399,7 @@ _e_dnd_cb_event_dnd_drop(void *data, int type, void *event) ev = event; id = e_util_winid_str_get(ev->win); - if (!evas_hash_find(_drop_win_hash, id)) return 1; + if (!eina_hash_find(_drop_win_hash, id)) return 1; ecore_x_selection_xdnd_request(ev->win, _xdnd->type); @@ -1415,7 +1418,7 @@ _e_dnd_cb_event_dnd_selection(void *data, int type, void *event) ev = event; id = e_util_winid_str_get(ev->win); - if (!evas_hash_find(_drop_win_hash, id)) return 1; + if (!eina_hash_find(_drop_win_hash, id)) return 1; if (ev->selection != ECORE_X_SELECTION_XDND) return 1; if (!strcmp("text/uri-list", _xdnd->type)) diff --git a/src/bin/e_exec.c b/src/bin/e_exec.c index 6bcacc1b80..ac34878d98 100644 --- a/src/bin/e_exec.c +++ b/src/bin/e_exec.c @@ -47,7 +47,7 @@ static E_Exec_Instance *_e_exec_cb_exec(void *data, Efreet_Desktop *desktop, cha static int _e_exec_cb_expire_timer(void *data); static int _e_exec_cb_exit(void *data, int type, void *event); -static Evas_Bool _e_exec_startup_id_pid_find(const Evas_Hash *hash __UNUSED__, const void *key __UNUSED__, void *value, void *data); +static Evas_Bool _e_exec_startup_id_pid_find(const Eina_Hash *hash __UNUSED__, const void *key __UNUSED__, void *value, void *data); static void _e_exec_error_dialog(Efreet_Desktop *desktop, const char *exec, Ecore_Exe_Event_Del *event, Ecore_Exe_Event_Data *error, Ecore_Exe_Event_Data *read); static void _fill_data(E_Config_Dialog_Data *cfdata); @@ -60,7 +60,7 @@ static void _dialog_save_cb(void *data, void *data2); /* local subsystem globals */ static Eina_List *e_exec_start_pending = NULL; -static Evas_Hash *e_exec_instances = NULL; +static Eina_Hash *e_exec_instances = NULL; static int startup_id = 0; static Ecore_Event_Handler *_e_exec_exit_handler = NULL; @@ -70,6 +70,8 @@ static Ecore_Event_Handler *_e_exec_border_add_handler = NULL; EAPI int e_exec_init(void) { + e_exec_instances = eina_hash_string_superfast_new(NULL); + _e_exec_exit_handler = ecore_event_handler_add(ECORE_EXE_EVENT_DEL, _e_exec_cb_exit, NULL); #if 0 @@ -89,7 +91,7 @@ e_exec_shutdown(void) if (_e_exec_exit_handler) ecore_event_handler_del(_e_exec_exit_handler); if (_e_exec_border_add_handler) ecore_event_handler_del(_e_exec_border_add_handler); - evas_hash_free(e_exec_instances); + eina_hash_free(e_exec_instances); eina_list_free(e_exec_start_pending); return 1; } @@ -132,7 +134,7 @@ e_exec_startup_id_pid_find(int startup_id, pid_t pid) search.desktop = NULL; search.startup_id = startup_id; search.pid = pid; - evas_hash_foreach(e_exec_instances, _e_exec_startup_id_pid_find, &search); + eina_hash_foreach(e_exec_instances, _e_exec_startup_id_pid_find, &search); return search.desktop; } @@ -242,16 +244,16 @@ _e_exec_cb_exec(void *data, Efreet_Desktop *desktop, char *exec, int remaining) inst->launch_time = ecore_time_get(); inst->expire_timer = ecore_timer_add(10.0, _e_exec_cb_expire_timer, inst); - l = evas_hash_find(e_exec_instances, desktop->orig_path); + l = eina_hash_find(e_exec_instances, desktop->orig_path); if (l) { l = eina_list_append(l, inst); - evas_hash_modify(e_exec_instances, desktop->orig_path, l); + eina_hash_modify(e_exec_instances, desktop->orig_path, l); } else { l = eina_list_append(l, inst); - e_exec_instances = evas_hash_add(e_exec_instances, desktop->orig_path, l); + eina_hash_add(e_exec_instances, desktop->orig_path, l); } e_exec_start_pending = eina_list_append(e_exec_start_pending, desktop); } @@ -344,14 +346,14 @@ _e_exec_cb_exit(void *data, int type, void *event) } if (inst->desktop) { - instances = evas_hash_find(e_exec_instances, inst->desktop->orig_path); + instances = eina_hash_find(e_exec_instances, inst->desktop->orig_path); if (instances) { instances = eina_list_remove(instances, inst); if (instances) - evas_hash_modify(e_exec_instances, inst->desktop->orig_path, instances); + eina_hash_modify(e_exec_instances, inst->desktop->orig_path, instances); else - e_exec_instances = evas_hash_del(e_exec_instances, inst->desktop->orig_path, NULL); + eina_hash_del(e_exec_instances, inst->desktop->orig_path, NULL); } } e_exec_start_pending = eina_list_remove(e_exec_start_pending, inst->desktop); @@ -362,7 +364,7 @@ _e_exec_cb_exit(void *data, int type, void *event) } static Evas_Bool -_e_exec_startup_id_pid_find(const Evas_Hash *hash __UNUSED__, const void *key __UNUSED__, void *value, void *data) +_e_exec_startup_id_pid_find(const Eina_Hash *hash __UNUSED__, const void *key __UNUSED__, void *value, void *data) { E_Exec_Search *search; Eina_List *instances, *l; diff --git a/src/bin/e_filereg.c b/src/bin/e_filereg.c index 2a93d59572..ef342e9430 100644 --- a/src/bin/e_filereg.c +++ b/src/bin/e_filereg.c @@ -8,7 +8,7 @@ * currently being used by E in core components should be registered * here and will be protected as best as E can. :) */ -static Evas_Hash *_e_filereg = NULL; +static Eina_Hash *_e_filereg = NULL; typedef struct _Filereg_Item Filereg_Item; struct _Filereg_Item @@ -17,33 +17,35 @@ struct _Filereg_Item int ref_count; }; -static Evas_Bool _filereg_hash_cb_free(const Evas_Hash *hash __UNUSED__, - const void *key __UNUSED__, +static Eina_Bool _filereg_hash_cb_free(const Eina_Hash *hash __UNUSED__, + const void *key __UNUSED__, void *data, void *fdata __UNUSED__); /* Externally accessible functions */ EAPI int -e_filereg_init(void) +e_filereg_init(void) { + _e_filereg = eina_hash_string_superfast_new(NULL); + return 1; } EAPI int -e_filereg_shutdown(void) +e_filereg_shutdown(void) { - evas_hash_foreach(_e_filereg, _filereg_hash_cb_free, NULL); - evas_hash_free(_e_filereg); + eina_hash_foreach(_e_filereg, _filereg_hash_cb_free, NULL); + eina_hash_free(_e_filereg); _e_filereg = NULL; return 1; } EAPI int -e_filereg_register(const char *path) +e_filereg_register(const char *path) { Filereg_Item *fi = NULL; - - fi = evas_hash_find(_e_filereg, path); - if (fi) + + fi = eina_hash_find(_e_filereg, path); + if (fi) { fi->ref_count++; return 1; @@ -52,22 +54,22 @@ e_filereg_register(const char *path) if (!fi) return 0; fi->path = eina_stringshare_add(path); fi->ref_count = 1; - _e_filereg = evas_hash_add(_e_filereg, path, fi); + eina_hash_add(_e_filereg, path, fi); return 1; } EAPI void -e_filereg_deregister(const char *path) +e_filereg_deregister(const char *path) { Filereg_Item *fi = NULL; - - fi = evas_hash_find(_e_filereg, path); - if (fi) + + fi = eina_hash_find(_e_filereg, path); + if (fi) { fi->ref_count--; - if (fi->ref_count == 0) + if (fi->ref_count == 0) { - _e_filereg = evas_hash_del(_e_filereg, path, fi); + eina_hash_del(_e_filereg, path, fi); if (fi->path) eina_stringshare_del(fi->path); E_FREE(fi); } @@ -75,22 +77,22 @@ e_filereg_deregister(const char *path) } EAPI Evas_Bool -e_filereg_file_protected(const char *path) +e_filereg_file_protected(const char *path) { Filereg_Item *fi = NULL; - - fi = evas_hash_find(_e_filereg, path); + + fi = eina_hash_find(_e_filereg, path); if (!fi) return 0; else return 1; } /* Private Functions */ -static Evas_Bool -_filereg_hash_cb_free(const Evas_Hash *hash __UNUSED__, const void *key __UNUSED__, - void *data, void *fdata __UNUSED__) +static Evas_Bool +_filereg_hash_cb_free(const Eina_Hash *hash __UNUSED__, const void *key __UNUSED__, + void *data, void *fdata __UNUSED__) { Filereg_Item *fi; - + fi = data; if (!fi) return 1; if (fi->path) eina_stringshare_del(fi->path); diff --git a/src/bin/e_fm.c b/src/bin/e_fm.c index 5173aae5ed..e227ffb0b6 100644 --- a/src/bin/e_fm.c +++ b/src/bin/e_fm.c @@ -3922,7 +3922,7 @@ _e_fm2_icon_desktop_load(E_Fm2_Icon *ic) { const char *type; - type = ecore_hash_get(desktop->x, "X-Enlightenment-Type"); + type = eina_hash_find(desktop->x, "X-Enlightenment-Type"); if (type) { if (!strcmp(type, "Mount")) ic->info.mount = 1; @@ -3937,7 +3937,7 @@ _e_fm2_icon_desktop_load(E_Fm2_Icon *ic) goto error; } } - type = ecore_hash_get(desktop->x, "X-Enlightenment-Removable-State"); + type = eina_hash_find(desktop->x, "X-Enlightenment-Removable-State"); if (type) { if (!strcmp(type, "Full")) diff --git a/src/bin/e_fm_custom.c b/src/bin/e_fm_custom.c index 677c4ada69..c4005da45f 100644 --- a/src/bin/e_fm_custom.c +++ b/src/bin/e_fm_custom.c @@ -3,12 +3,12 @@ */ #include "e.h" -static Evas_Bool _e_fm2_custom_file_hash_foreach_list(const Evas_Hash *hash, const void *key, void *data, void *fdata); -static Eina_List *_e_fm2_custom_hash_key_base_list(Evas_Hash *hash, const char *str); -//static Evas_Bool _e_fm2_custom_file_hash_foreach_sub_list(Evas_Hash *hash, const char *key, void *data, void *fdata); -//static Eina_List *_e_fm2_custom_hash_key_sub_list(Evas_Hash *hash, const char *str); -static Evas_Bool _e_fm2_custom_file_hash_foreach(const Evas_Hash *hash, const void *key, void *data, void *fdata); -static Evas_Bool _e_fm2_custom_file_hash_foreach_save(const Evas_Hash *hash, const void *key, void *data, void *fdata); +static Eina_Bool _e_fm2_custom_file_hash_foreach_list(const Eina_Hash *hash, const void *key, void *data, void *fdata); +static Eina_List *_e_fm2_custom_hash_key_base_list(Eina_Hash *hash, const char *str); +//static Eina_Bool _e_fm2_custom_file_hash_foreach_sub_list(Eina_Hash *hash, const char *key, void *data, void *fdata); +//static Eina_List *_e_fm2_custom_hash_key_sub_list(Eina_Hash *hash, const char *str); +static Eina_Bool _e_fm2_custom_file_hash_foreach(const Eina_Hash *hash, const void *key, void *data, void *fdata); +static Eina_Bool _e_fm2_custom_file_hash_foreach_save(const Eina_Hash *hash, const void *key, void *data, void *fdata); static void _e_fm2_custom_file_info_load(void); static void _e_fm2_custom_file_info_save(void); static void _e_fm2_custom_file_info_free(void); @@ -17,10 +17,9 @@ static void _e_fm2_custom_file_cb_defer_save(void *data); static E_Powersave_Deferred_Action*_e_fm2_flush_defer = NULL; static Eet_File *_e_fm2_custom_file = NULL; static Eet_Data_Descriptor *_e_fm2_custom_file_edd = NULL; -static Evas_Hash *_e_fm2_custom_hash = NULL; +static Eina_Hash *_e_fm2_custom_hash = NULL; static int _e_fm2_custom_writes = 0; - /* FIXME: this uses a flat path key for custom file info. this is fine as * long as we only expect a limited number of custom info nodes. if we * start to see whole dire trees stored this way things will suck. we need @@ -44,14 +43,14 @@ e_fm2_custom_file_init(void) eddc.func.list_free = (void *(*)(void *)) eina_list_free; eddc.func.hash_foreach = (void (*) (void *, int (*) (void *, const char *, void *, void *), void *)) - evas_hash_foreach; - eddc.func.hash_add = (void *(*) (void *, const char *, void *)) evas_hash_add; - eddc.func.hash_free = (void (*) (void *)) evas_hash_free; + eina_hash_foreach; + eddc.func.hash_add = (void* (*) (void *, const char *, void *)) eet_eina_hash_add_alloc; + eddc.func.hash_free = (void (*) (Eina_Hash *)) eina_hash_free; eddc.name = "e_fm_custom_file"; eddc.size = sizeof(E_Fm2_Custom_File); _e_fm2_custom_file_edd = eet_data_descriptor2_new(&eddc); -#define DAT(x, y, z) EET_DATA_DESCRIPTOR_ADD_BASIC(_e_fm2_custom_file_edd, E_Fm2_Custom_File, x, y, z) +#define DAT(x, y, z) EET_DATA_DESCRIPTOR_ADD_BASIC(_e_fm2_custom_file_edd, E_Fm2_Custom_File, x, y, z) DAT("g.x", geom.x, EET_T_INT); DAT("g.y", geom.y, EET_T_INT); DAT("g.w", geom.w, EET_T_INT); @@ -85,11 +84,11 @@ EAPI E_Fm2_Custom_File * e_fm2_custom_file_get(const char *path) { E_Fm2_Custom_File *cf; - + _e_fm2_custom_file_info_load(); if (!_e_fm2_custom_file) return NULL; if (_e_fm2_flush_defer) e_fm2_custom_file_flush(); - cf = evas_hash_find(_e_fm2_custom_hash, path); + cf = eina_hash_find(_e_fm2_custom_hash, path); return cf; } @@ -99,10 +98,10 @@ e_fm2_custom_file_set(const char *path, E_Fm2_Custom_File *cf) _e_fm2_custom_file_info_load(); if (!_e_fm2_custom_file) return; if (_e_fm2_flush_defer) e_fm2_custom_file_flush(); - if (evas_hash_find(_e_fm2_custom_hash, path) != cf) + if (eina_hash_find(_e_fm2_custom_hash, path) != cf) { E_Fm2_Custom_File *cf2; - + cf2 = calloc(1, sizeof(E_Fm2_Custom_File)); if (cf2) { @@ -111,7 +110,9 @@ e_fm2_custom_file_set(const char *path, E_Fm2_Custom_File *cf) cf2->icon.icon = eina_stringshare_add(cf->icon.icon); if (cf->label) cf2->label = eina_stringshare_add(cf->label); - _e_fm2_custom_hash = evas_hash_add(_e_fm2_custom_hash, path, cf2); + if (!_e_fm2_custom_hash) + _e_fm2_custom_hash = eina_hash_string_superfast_new(NULL); + eina_hash_add(_e_fm2_custom_hash, path, cf2); } } _e_fm2_custom_writes = 1; @@ -122,21 +123,20 @@ e_fm2_custom_file_del(const char *path) { Eina_List *list, *l; E_Fm2_Custom_File *cf2; - + _e_fm2_custom_file_info_load(); if (!_e_fm2_custom_file) return; if (_e_fm2_flush_defer) e_fm2_custom_file_flush(); - + list = _e_fm2_custom_hash_key_base_list(_e_fm2_custom_hash, path); if (list) { for (l = list; l; l = l->next) { - cf2 = evas_hash_find(_e_fm2_custom_hash, l->data); + cf2 = eina_hash_find(_e_fm2_custom_hash, l->data); if (cf2) { - _e_fm2_custom_hash = evas_hash_del(_e_fm2_custom_hash, - l->data, cf2); + eina_hash_del(_e_fm2_custom_hash, l->data, cf2); if (cf2->icon.icon) eina_stringshare_del(cf2->icon.icon); if (cf2->label) eina_stringshare_del(cf2->label); free(cf2); @@ -156,42 +156,40 @@ e_fm2_custom_file_rename(const char *path, const char *new_path) _e_fm2_custom_file_info_load(); if (!_e_fm2_custom_file) return; if (_e_fm2_flush_defer) e_fm2_custom_file_flush(); - cf2 = evas_hash_find(_e_fm2_custom_hash, path); + cf2 = eina_hash_find(_e_fm2_custom_hash, path); if (cf2) { - _e_fm2_custom_hash = evas_hash_del(_e_fm2_custom_hash, path, cf2); - cf = evas_hash_find(_e_fm2_custom_hash, new_path); + eina_hash_del(_e_fm2_custom_hash, path, cf2); + cf = eina_hash_find(_e_fm2_custom_hash, new_path); if (cf) { if (cf->icon.icon) eina_stringshare_del(cf->icon.icon); if (cf->label) eina_stringshare_del(cf->label); free(cf); } - _e_fm2_custom_hash = evas_hash_add(_e_fm2_custom_hash, new_path, cf2); + eina_hash_add(_e_fm2_custom_hash, new_path, cf2); } list = _e_fm2_custom_hash_key_base_list(_e_fm2_custom_hash, path); if (list) { for (l = list; l; l = l->next) { - cf2 = evas_hash_find(_e_fm2_custom_hash, l->data); + cf2 = eina_hash_find(_e_fm2_custom_hash, l->data); if (cf2) { char buf[PATH_MAX]; - + strcpy(buf, new_path); strcat(buf, (char *)l->data + strlen(path)); - _e_fm2_custom_hash = evas_hash_del(_e_fm2_custom_hash, - l->data, cf2); - cf = evas_hash_find(_e_fm2_custom_hash, buf); + eina_hash_del(_e_fm2_custom_hash, l->data, cf2); + cf = eina_hash_find(_e_fm2_custom_hash, buf); if (cf) { if (cf->icon.icon) eina_stringshare_del(cf->icon.icon); if (cf->label) eina_stringshare_del(cf->label); free(cf); } - _e_fm2_custom_hash = evas_hash_add(_e_fm2_custom_hash, - buf, cf2); + eina_hash_add(_e_fm2_custom_hash, buf, cf2); } } eina_list_free(list); @@ -219,36 +217,35 @@ struct _E_Custom_List int base_len; }; -static Evas_Bool -_e_fm2_custom_file_hash_foreach_list(const Evas_Hash *hash, const void *key, void *data, void *fdata) +static Eina_Bool +_e_fm2_custom_file_hash_foreach_list(const Eina_Hash *hash, const void *key, void *data, void *fdata) { struct _E_Custom_List *cl; - + cl = fdata; if (!strncmp(cl->base, key, cl->base_len)) cl->l = eina_list_append(cl->l, key); return 1; } - + static Eina_List * -_e_fm2_custom_hash_key_base_list(Evas_Hash *hash, const char *str) +_e_fm2_custom_hash_key_base_list(Eina_Hash *hash, const char *str) { struct _E_Custom_List cl; - + cl.l = NULL; cl.base = str; cl.base_len = strlen(cl.base); - evas_hash_foreach(hash, - _e_fm2_custom_file_hash_foreach_list, &cl); + eina_hash_foreach(hash, _e_fm2_custom_file_hash_foreach_list, &cl); return cl.l; } /* -static Evas_Bool -_e_fm2_custom_file_hash_foreach_sub_list(const Evas_Hash *hash, const void *key, void *data, void *fdata) +static Eina_Bool +_e_fm2_custom_file_hash_foreach_sub_list(const Eina_Hash *hash, const void *key, void *data, void *fdata) { struct _E_Custom_List *cl; - + cl = fdata; if (!strncmp(cl->base, key, strlen(key))) cl->l = eina_list_append(cl->l, key); @@ -258,23 +255,23 @@ _e_fm2_custom_file_hash_foreach_sub_list(const Evas_Hash *hash, const void *key, /* static Eina_List * -_e_fm2_custom_hash_key_sub_list(const Evas_Hash *hash, const void *str) +_e_fm2_custom_hash_key_sub_list(const Eina_Hash *hash, const void *str) { struct _E_Custom_List cl; - + cl.l = NULL; cl.base = str; - evas_hash_foreach(hash, + eina_hash_foreach(hash, _e_fm2_custom_file_hash_foreach_sub_list, &cl); return cl.l; } */ -static Evas_Bool -_e_fm2_custom_file_hash_foreach(const Evas_Hash *hash, const void *key, void *data, void *fdata) +static Eina_Bool +_e_fm2_custom_file_hash_foreach(const Eina_Hash *hash, const void *key, void *data, void *fdata) { E_Fm2_Custom_File *cf; - + cf = data; if (cf->icon.icon) eina_stringshare_del(cf->icon.icon); if (cf->label) eina_stringshare_del(cf->label); @@ -282,12 +279,12 @@ _e_fm2_custom_file_hash_foreach(const Evas_Hash *hash, const void *key, void *da return 1; } -static Evas_Bool -_e_fm2_custom_file_hash_foreach_save(const Evas_Hash *hash, const void *key, void *data, void *fdata) +static Eina_Bool +_e_fm2_custom_file_hash_foreach_save(const Eina_Hash *hash, const void *key, void *data, void *fdata) { Eet_File *ef; E_Fm2_Custom_File *cf; - + ef = fdata; cf = data; eet_data_write(ef, _e_fm2_custom_file_edd, key, cf, 1); @@ -320,8 +317,12 @@ _e_fm2_custom_file_info_load(void) cf = eet_data_read(_e_fm2_custom_file, _e_fm2_custom_file_edd, list[i]); if (cf) - _e_fm2_custom_hash = evas_hash_add(_e_fm2_custom_hash, - list[i], cf); + { + if (!_e_fm2_custom_hash) + _e_fm2_custom_hash = + eina_hash_string_superfast_new(NULL); + eina_hash_add(_e_fm2_custom_hash, list[i], cf); + } } free(list); } @@ -341,7 +342,7 @@ _e_fm2_custom_file_info_save(void) e_user_homedir_get()); ef = eet_open(buf, EET_FILE_MODE_WRITE); if (!ef) return; - evas_hash_foreach(_e_fm2_custom_hash, + eina_hash_foreach(_e_fm2_custom_hash, _e_fm2_custom_file_hash_foreach_save, ef); eet_close(ef); snprintf(buf2, sizeof(buf2), "%s/.e/e/fileman/custom.cfg", @@ -368,9 +369,9 @@ _e_fm2_custom_file_info_free(void) } if (_e_fm2_custom_hash) { - evas_hash_foreach(_e_fm2_custom_hash, + eina_hash_foreach(_e_fm2_custom_hash, _e_fm2_custom_file_hash_foreach, NULL); - evas_hash_free(_e_fm2_custom_hash); + eina_hash_free(_e_fm2_custom_hash); _e_fm2_custom_hash = NULL; } } diff --git a/src/bin/e_fm_main.c b/src/bin/e_fm_main.c index 2343213183..7cdcdcad87 100644 --- a/src/bin/e_fm_main.c +++ b/src/bin/e_fm_main.c @@ -39,9 +39,11 @@ #include "config.h" #define E_TYPEDEFS +#include "e_config_data.h" #include "e_fm_op.h" #include "e_prefix.h" #undef E_TYPEDEFS +#include "e_config_data.h" #include "e_fm_op.h" #include "e_prefix.h" diff --git a/src/bin/e_fm_mime.c b/src/bin/e_fm_mime.c index 3a98dfaeb3..4ad9e24280 100644 --- a/src/bin/e_fm_mime.c +++ b/src/bin/e_fm_mime.c @@ -12,12 +12,12 @@ struct _E_Fm2_Mime_Handler_Tuple }; /* local subsystem functions */ -static Evas_Bool _e_fm2_mime_handler_glob_match_foreach(const Evas_Hash *hash __UNUSED__, const void *key, void *data, void *fdata); -static Evas_Bool _e_fm_mime_icon_foreach(const Evas_Hash *hash __UNUSED__, const void *key __UNUSED__, void *data, void *fdata); +static Eina_Bool _e_fm2_mime_handler_glob_match_foreach(const Eina_Hash *hash __UNUSED__, const void *key, void *data, void *fdata); +static Eina_Bool _e_fm_mime_icon_foreach(const Eina_Hash *hash __UNUSED__, const void *key __UNUSED__, void *data, void *fdata); -static Evas_Hash *icon_map = NULL; -static Evas_Hash *_mime_handlers = NULL; -static Evas_Hash *_glob_handlers = NULL; +static Eina_Hash *icon_map = NULL; +static Eina_Hash *_mime_handlers = NULL; +static Eina_Hash *_glob_handlers = NULL; /* externally accessible functions */ EAPI const char * @@ -40,18 +40,18 @@ e_fm_mime_icon_get(const char *mime) const char *homedir = NULL; Eina_List *l = NULL; E_Config_Mime_Icon *mi; - + /* 0.0 clean out hash cache once it has mroe than 512 entries in it */ - if (evas_hash_size(icon_map) > 512) e_fm_mime_icon_cache_flush(); - + if (eina_hash_population(icon_map) > 512) e_fm_mime_icon_cache_flush(); + /* 0. look in mapping cache */ - val = evas_hash_find(icon_map, mime); + val = eina_hash_find(icon_map, mime); if (val) return val; - + ecore_strlcpy(buf2, mime, sizeof(buf2)); val = strchr(buf2, '/'); if (val) *val = 0; - + /* 1. look up in mapping to file or thumb (thumb has flag)*/ for (l = e_config->mime_icons; l; l = l->next) { @@ -100,12 +100,13 @@ e_fm_mime_icon_get(const char *mime) if (ecore_file_exists(buf)) goto ok; snprintf(buf, sizeof(buf), "%s/data/icons/%s.png", e_prefix_data_get(), buf2); if (ecore_file_exists(buf)) goto ok; - + return NULL; - + ok: val = (char *)eina_stringshare_add(buf); - icon_map = evas_hash_add(icon_map, mime, val); + if (!icon_map) icon_map = eina_hash_string_superfast_new(NULL); + eina_hash_add(icon_map, mime, val); return val; } @@ -113,20 +114,20 @@ EAPI void e_fm_mime_icon_cache_flush(void) { Eina_List *freelist = NULL; - - evas_hash_foreach(icon_map, _e_fm_mime_icon_foreach, &freelist); + + eina_hash_foreach(icon_map, _e_fm_mime_icon_foreach, &freelist); while (freelist) { eina_stringshare_del(freelist->data); freelist = eina_list_remove_list(freelist, freelist); } - evas_hash_free(icon_map); + eina_hash_free(icon_map); icon_map = NULL; } /* create (allocate), set properties, and return a new mime handler */ EAPI E_Fm2_Mime_Handler * -e_fm2_mime_handler_new(const char *label, const char *icon_group, +e_fm2_mime_handler_new(const char *label, const char *icon_group, void (*action_func) (Evas_Object *obj, const char *path, void *data), void *action_data, int (test_func) (Evas_Object *obj, const char *path, void *data), @@ -145,22 +146,22 @@ e_fm2_mime_handler_new(const char *label, const char *icon_group, handler->action_data = action_data; handler->test_func = test_func; handler->test_data = test_data; - + return handler; } EAPI void -e_fm2_mime_handler_free(E_Fm2_Mime_Handler *handler) +e_fm2_mime_handler_free(E_Fm2_Mime_Handler *handler) { if (!handler) return; - + eina_stringshare_del(handler->label); if (handler->icon_group) eina_stringshare_del(handler->icon_group); E_FREE(handler); } /* associate a certain mime type with a handler */ -EAPI Evas_Bool +EAPI Eina_Bool e_fm2_mime_handler_mime_add(E_Fm2_Mime_Handler *handler, const char *mime) { Eina_List *handlers = NULL; @@ -168,23 +169,24 @@ e_fm2_mime_handler_mime_add(E_Fm2_Mime_Handler *handler, const char *mime) if ((!handler) || (!mime)) return 0; /* if there's an entry for this mime already, then append to its list */ - if ((handlers = evas_hash_find(_mime_handlers, mime))) + if ((handlers = eina_hash_find(_mime_handlers, mime))) { handlers = eina_list_append(handlers, handler); - evas_hash_modify(_mime_handlers, mime, handlers); + eina_hash_modify(_mime_handlers, mime, handlers); } else { /* no previous entry for this mime, lets add one */ handlers = eina_list_append(handlers, handler); - _mime_handlers = evas_hash_add(_mime_handlers, mime, handlers); + if (!_mime_handlers) _mime_handlers = eina_hash_string_superfast_new(NULL); + eina_hash_add(_mime_handlers, mime, handlers); } return 1; } /* associate a certain glob with a handler */ -EAPI Evas_Bool +EAPI Eina_Bool e_fm2_mime_handler_glob_add(E_Fm2_Mime_Handler *handler, const char *glob) { Eina_List *handlers = NULL; @@ -192,16 +194,17 @@ e_fm2_mime_handler_glob_add(E_Fm2_Mime_Handler *handler, const char *glob) if ((!handler) || (!glob)) return 0; /* if there's an entry for this glob already, then append to its list */ - if ((handlers = evas_hash_find(_glob_handlers, glob))) + if ((handlers = eina_hash_find(_glob_handlers, glob))) { handlers = eina_list_append(handlers, handler); - evas_hash_modify(_glob_handlers, glob, handlers); + eina_hash_modify(_glob_handlers, glob, handlers); } else { /* no previous entry for this glob, lets add one */ handlers = eina_list_append(handlers, handler); - _glob_handlers = evas_hash_add(_glob_handlers, glob, handlers); + if (!_glob_handlers) _glob_handlers = eina_hash_string_superfast_new(NULL); + eina_hash_add(_glob_handlers, glob, handlers); } return 1; @@ -209,52 +212,66 @@ e_fm2_mime_handler_glob_add(E_Fm2_Mime_Handler *handler, const char *glob) /* delete a certain handler for a certian mime */ EAPI void -e_fm2_mime_handler_mime_del(E_Fm2_Mime_Handler *handler, const char *mime) +e_fm2_mime_handler_mime_del(E_Fm2_Mime_Handler *handler, const char *mime) { Eina_List *handlers = NULL; if ((!handler) || (!mime)) return; /* if there's an entry for this mime already, then remove from list */ - if ((handlers = evas_hash_find(_mime_handlers, mime))) + if ((handlers = eina_hash_find(_mime_handlers, mime))) { handlers = eina_list_remove(handlers, handler); if (handlers) - evas_hash_modify(_mime_handlers, mime, handlers); + eina_hash_modify(_mime_handlers, mime, handlers); else - _mime_handlers = evas_hash_del(_mime_handlers, mime, handlers); + { + eina_hash_del(_mime_handlers, mime, handlers); + if (!eina_hash_population(_mime_handlers)) + { + eina_hash_free(_mime_handlers); + _mime_handlers = NULL; + } + } } } /* delete a certain handler for a certain glob */ EAPI void -e_fm2_mime_handler_glob_del(E_Fm2_Mime_Handler *handler, const char *glob) +e_fm2_mime_handler_glob_del(E_Fm2_Mime_Handler *handler, const char *glob) { Eina_List *handlers = NULL; if ((!handler) || (!glob)) return; /* if there's an entry for this glob already, then remove from list */ - if ((handlers = evas_hash_find(_glob_handlers, glob))) + if ((handlers = eina_hash_find(_glob_handlers, glob))) { handlers = eina_list_remove(handlers, handler); if (handlers) - evas_hash_modify(_glob_handlers, glob, handlers); + eina_hash_modify(_glob_handlers, glob, handlers); else - _glob_handlers = evas_hash_del(_glob_handlers, glob, handlers); + { + eina_hash_del(_glob_handlers, glob, handlers); + if (!eina_hash_population(_glob_handlers)) + { + eina_hash_free(_glob_handlers); + _glob_handlers = NULL; + } + } } } -/* get the list of mime handlers for a mime. +/* get the list of mime handlers for a mime. NOTE: the list should be free()'ed */ EAPI Eina_List * e_fm2_mime_handler_mime_handlers_get(const char *mime) { if ((!mime) || (!_mime_handlers)) return NULL; - return evas_hash_find(_mime_handlers, mime); + return eina_hash_find(_mime_handlers, mime); } -/* get the list of glob handlers for a glob. +/* get the list of glob handlers for a glob. NOTE: the list should be free()'ed */ EAPI Eina_List * e_fm2_mime_handler_glob_handlers_get(const char *glob) @@ -267,14 +284,14 @@ e_fm2_mime_handler_glob_handlers_get(const char *glob) tuple = E_NEW(E_Fm2_Mime_Handler_Tuple, 1); tuple->list = NULL; tuple->str = glob; - evas_hash_foreach(_glob_handlers, _e_fm2_mime_handler_glob_match_foreach, tuple); + eina_hash_foreach(_glob_handlers, _e_fm2_mime_handler_glob_match_foreach, tuple); handlers = tuple->list; E_FREE(tuple); return handlers; } /* call a certain handler */ -EAPI Evas_Bool +EAPI Eina_Bool e_fm2_mime_handler_call(E_Fm2_Mime_Handler *handler, Evas_Object *obj, const char *path) { if ((!handler) || (!obj) || (!path) || (!handler->action_func)) @@ -353,15 +370,15 @@ e_fm2_mime_handler_test(E_Fm2_Mime_Handler *handler, Evas_Object *obj, const cha /* local subsystem functions */ /* used to loop a glob hash and determine if the glob handler matches the filename */ -static Evas_Bool -_e_fm2_mime_handler_glob_match_foreach(const Evas_Hash *hash __UNUSED__, const void *key, void *data, void *fdata) +static Eina_Bool +_e_fm2_mime_handler_glob_match_foreach(const Eina_Hash *hash __UNUSED__, const void *key, void *data, void *fdata) { E_Fm2_Mime_Handler_Tuple *tuple; Eina_List *handlers = NULL; Eina_List *l = NULL; tuple = fdata; - if (e_util_glob_match(tuple->str, key)) + if (e_util_glob_match(tuple->str, key)) { handlers = data; for (l = handlers; l; l = l->next) @@ -370,15 +387,15 @@ _e_fm2_mime_handler_glob_match_foreach(const Evas_Hash *hash __UNUSED__, const v tuple->list = eina_list_append(tuple->list, l->data); } } - + return 1; } -static Evas_Bool -_e_fm_mime_icon_foreach(const Evas_Hash *hash __UNUSED__, const void *key __UNUSED__, void *data, void *fdata) +static Eina_Bool +_e_fm_mime_icon_foreach(const Eina_Hash *hash __UNUSED__, const void *key __UNUSED__, void *data, void *fdata) { Eina_List **freelist; - + freelist = fdata; *freelist = eina_list_append(*freelist, data); return 1; diff --git a/src/bin/e_fm_shared.h b/src/bin/e_fm_shared.h index 9731cb0789..bb86679261 100644 --- a/src/bin/e_fm_shared.h +++ b/src/bin/e_fm_shared.h @@ -139,12 +139,12 @@ _e_volume_edd_new(void) eddc.func.list_data = (void *(*)(void *)) eina_list_data_get; eddc.func.hash_foreach = (void (*) (void *, int (*) (void *, const char *, void *, void *), void *)) - evas_hash_foreach; - eddc.func.hash_add = (void *(*) (void *, const char *, void *)) evas_hash_add; - eddc.func.hash_free = (void (*) (void *)) evas_hash_free; + eina_hash_foreach; + eddc.func.hash_add = (void* (*) (void *, const char *, void *)) eet_eina_hash_add_alloc; + eddc.func.hash_free = (void (*) (void *)) eina_hash_free; eddc.name = "e_volume"; eddc.size = sizeof(E_Volume); - + edd = eet_data_descriptor2_new(&eddc); #define DAT(x, y, z) EET_DATA_DESCRIPTOR_ADD_BASIC(edd, E_Volume, x, y, z) DAT("type", type, EET_T_INT); @@ -179,12 +179,12 @@ _e_storage_edd_new(void) eddc.func.list_data = (void *(*)(void *)) eina_list_data_get; eddc.func.hash_foreach = (void (*) (void *, int (*) (void *, const char *, void *, void *), void *)) - evas_hash_foreach; - eddc.func.hash_add = (void *(*) (void *, const char *, void *)) evas_hash_add; - eddc.func.hash_free = (void (*) (void *)) evas_hash_free; + eina_hash_foreach; + eddc.func.hash_add = (void* (*) (void *, const char *, void *)) eet_eina_hash_add_alloc; + eddc.func.hash_free = (void (*) (Eina_Hash *)) eina_hash_free; eddc.name = "e_storage"; eddc.size = sizeof(E_Storage); - + edd = eet_data_descriptor2_new(&eddc); #define DAT(x, y, z) EET_DATA_DESCRIPTOR_ADD_BASIC(edd, E_Storage, x, y, z) DAT("type", type, EET_T_INT); diff --git a/src/bin/e_font.c b/src/bin/e_font.c index 6685518125..68cc996dd8 100644 --- a/src/bin/e_font.c +++ b/src/bin/e_font.c @@ -5,9 +5,9 @@ #define E_TOK_STYLE ":style=" -static Evas_Bool _font_hash_free_cb(const Evas_Hash *hash __UNUSED__, const void *key __UNUSED__, void *data, void *fdata __UNUSED__); -static Evas_Hash *_e_font_available_hash_add(Evas_Hash *font_hash, const char *full_name); -static E_Font_Properties *_e_font_fontconfig_name_parse(Evas_Hash **font_hash, E_Font_Properties *efp, const char *font); +static Eina_Bool _font_hash_free_cb(const Eina_Hash *hash __UNUSED__, const void *key __UNUSED__, void *data, void *fdata __UNUSED__); +static Eina_Hash *_e_font_available_hash_add(Eina_Hash *font_hash, const char *full_name); +static E_Font_Properties *_e_font_fontconfig_name_parse(Eina_Hash **font_hash, E_Font_Properties *efp, const char *font); static char _fn_buf[1024]; EAPI int @@ -150,8 +150,8 @@ e_font_properties_free(E_Font_Properties *efp) free(efp); } -static Evas_Bool -_font_hash_free_cb(const Evas_Hash *hash __UNUSED__, const void *key __UNUSED__, void *data, void *fdata __UNUSED__) +static Eina_Bool +_font_hash_free_cb(const Eina_Hash *hash __UNUSED__, const void *key __UNUSED__, void *data, void *fdata __UNUSED__) { E_Font_Properties *efp; @@ -161,10 +161,10 @@ _font_hash_free_cb(const Evas_Hash *hash __UNUSED__, const void *key __UNUSED__, } EAPI void -e_font_available_hash_free(Evas_Hash *hash) +e_font_available_hash_free(Eina_Hash *hash) { - evas_hash_foreach(hash, _font_hash_free_cb, NULL); - evas_hash_free(hash); + eina_hash_foreach(hash, _font_hash_free_cb, NULL); + eina_hash_free(hash); } EAPI E_Font_Properties * @@ -175,7 +175,7 @@ e_font_fontconfig_name_parse(const char *font) } static E_Font_Properties * -_e_font_fontconfig_name_parse(Evas_Hash **font_hash, E_Font_Properties *efp, const char *font) +_e_font_fontconfig_name_parse(Eina_Hash **font_hash, E_Font_Properties *efp, const char *font) { char *s1; @@ -203,12 +203,16 @@ _e_font_fontconfig_name_parse(Evas_Hash **font_hash, E_Font_Properties *efp, con { style = s1 + strlen(E_TOK_STYLE); - if (font_hash) efp = evas_hash_find(*font_hash, name); + if (font_hash) efp = eina_hash_find(*font_hash, name); if (efp == NULL) { efp = calloc(1, sizeof(E_Font_Properties)); efp->name = eina_stringshare_add(name); - if (font_hash) *font_hash = evas_hash_add(*font_hash, name, efp); + if (font_hash) + { + if (!*font_hash) *font_hash = eina_hash_string_superfast_new(NULL); + eina_hash_add(*font_hash, name, efp); + } } s2 = strchr(style, ','); if (s2) @@ -229,29 +233,33 @@ _e_font_fontconfig_name_parse(Evas_Hash **font_hash, E_Font_Properties *efp, con } else { - if (font_hash) efp = evas_hash_find(*font_hash, font); + if (font_hash) efp = eina_hash_find(*font_hash, font); if (efp == NULL) { efp = calloc(1, sizeof(E_Font_Properties)); efp->name = eina_stringshare_add(font); - if (font_hash) *font_hash = evas_hash_add(*font_hash, font, efp); + if (font_hash) + { + if (!*font_hash) *font_hash = eina_hash_string_superfast_new(NULL); + eina_hash_add(*font_hash, font, efp); + } } } return efp; } -static Evas_Hash * -_e_font_available_hash_add(Evas_Hash *font_hash, const char *full_name) +static Eina_Hash * +_e_font_available_hash_add(Eina_Hash *font_hash, const char *full_name) { _e_font_fontconfig_name_parse(&font_hash, NULL, full_name); return font_hash; } -EAPI Evas_Hash * +EAPI Eina_Hash * e_font_available_list_parse(Eina_List *list) { - Evas_Hash *font_hash; + Eina_Hash *font_hash; Eina_List *next; font_hash = NULL; diff --git a/src/bin/e_font.h b/src/bin/e_font.h index 3c0fd973de..a41035c2ea 100644 --- a/src/bin/e_font.h +++ b/src/bin/e_font.h @@ -40,8 +40,8 @@ EAPI int e_font_shutdown(void); EAPI void e_font_apply(void); EAPI Eina_List *e_font_available_list(void); EAPI void e_font_available_list_free(Eina_List *available); -EAPI Evas_Hash *e_font_available_list_parse(Eina_List *list); -EAPI void e_font_available_hash_free(Evas_Hash *hash); +EAPI Eina_Hash *e_font_available_list_parse(Eina_List *list); +EAPI void e_font_available_hash_free(Eina_Hash *hash); EAPI E_Font_Properties *e_font_fontconfig_name_parse(const char *font); EAPI const char *e_font_fontconfig_name_get(const char *name, const char *style); EAPI void e_font_properties_free(E_Font_Properties *efp); diff --git a/src/bin/e_gadcon.c b/src/bin/e_gadcon.c index 07aa1ff12a..8f693d27d7 100644 --- a/src/bin/e_gadcon.c +++ b/src/bin/e_gadcon.c @@ -182,7 +182,7 @@ struct _E_Layout_Item_Container } /********************/ -static Evas_Hash *providers = NULL; +static Eina_Hash *providers = NULL; static Eina_List *providers_list = NULL; static Eina_List *gadcons = NULL; @@ -209,8 +209,9 @@ e_gadcon_provider_register(const E_Gadcon_Client_Class *cc) { Eina_List *l; E_Gadcon *gc; - - providers = evas_hash_direct_add(providers, cc->name, cc); + + if (!providers) providers = eina_hash_string_superfast_new(NULL); + eina_hash_direct_add(providers, cc->name, cc); providers_list = eina_list_append(providers_list, cc); for (l = gadcons; l; l = l->next) { @@ -245,7 +246,7 @@ e_gadcon_provider_unregister(const E_Gadcon_Client_Class *cc) dlist = eina_list_remove_list(dlist, dlist); e_object_del(E_OBJECT(gcc)); } - providers = evas_hash_del(providers, cc->name, cc); + eina_hash_del(providers, cc->name, cc); providers_list = eina_list_remove(providers_list, cc); } @@ -408,7 +409,7 @@ e_gadcon_populate(E_Gadcon *gc) cf_gcc = l->data; if (!cf_gcc->name) continue; - cc = evas_hash_find(providers, cf_gcc->name); + cc = eina_hash_find(providers, cf_gcc->name); if (cc) { E_Gadcon_Client *gcc; @@ -768,7 +769,7 @@ e_gadcon_client_config_new(E_Gadcon *gc, const char *name) E_OBJECT_TYPE_CHECK_RETURN(gc, E_GADCON_TYPE, NULL); if (!name) return NULL; - cc = evas_hash_find(providers, name); + cc = eina_hash_find(providers, name); if (!cc) return NULL; if (!_e_gadcon_client_class_feature_check(cc, "id_new", cc->func.id_new)) return NULL; @@ -2140,7 +2141,7 @@ _e_gadcon_cb_dnd_enter(void *data, const char *type, void *event) E_Gadcon_Client_Class *cc; gcc = ev->data; - cc = evas_hash_find(providers, gcc->name); + cc = eina_hash_find(providers, gcc->name); if (cc) { if (!gcc->style) diff --git a/src/bin/e_int_config_modules.c b/src/bin/e_int_config_modules.c index 70aee1865f..ccc53f7283 100644 --- a/src/bin/e_int_config_modules.c +++ b/src/bin/e_int_config_modules.c @@ -49,63 +49,63 @@ const CFTypes _types[] = /* local function protos */ static void *_create_data (E_Config_Dialog *cfd); static void _fill_data (E_Config_Dialog_Data *cfdata); -static void _free_data (E_Config_Dialog *cfd, +static void _free_data (E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata); -static Evas_Object *_basic_create (E_Config_Dialog *cfd, Evas *evas, +static Evas_Object *_basic_create (E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata); static void _fill_type_hash (void); static void _load_modules (const char *dir); static void _fill_list (Evas_Object *obj, int enabled); -static Evas_Bool _fill_list_types_avail(const Evas_Hash *hash __UNUSED__, +static Eina_Bool _fill_list_types_avail(const Eina_Hash *hash __UNUSED__, const void *key __UNUSED__, void *data, void *fdata); -static Evas_Bool _fill_list_types_load (const Evas_Hash *hash __UNUSED__, +static Eina_Bool _fill_list_types_load (const Eina_Hash *hash __UNUSED__, const void *key __UNUSED__, void *data, void *fdata); -static Evas_Bool _fill_list_types (Evas_Object *obj, CFType *cft, +static Eina_Bool _fill_list_types (Evas_Object *obj, CFType *cft, int enabled); -static Evas_Bool _types_hash_cb_free (const Evas_Hash *hash __UNUSED__, - const void *key __UNUSED__, +static Eina_Bool _types_hash_cb_free (const Eina_Hash *hash __UNUSED__, + const void *key __UNUSED__, void *data, void *fdata __UNUSED__); -static Evas_Bool _mod_hash_cb_free (const Evas_Hash *hash __UNUSED__, - const void *key __UNUSED__, +static Eina_Bool _mod_hash_cb_free (const Eina_Hash *hash __UNUSED__, + const void *key __UNUSED__, void *data, void *fdata __UNUSED__); -static Evas_Bool _mod_hash_avail_list (const Evas_Hash *hash __UNUSED__, - const void *key __UNUSED__, +static Eina_Bool _mod_hash_avail_list (const Eina_Hash *hash __UNUSED__, + const void *key __UNUSED__, void *data, void *fdata); -static Evas_Bool _mod_hash_load_list (const Evas_Hash *hash __UNUSED__, - const void *key __UNUSED__, +static Eina_Bool _mod_hash_load_list (const Eina_Hash *hash __UNUSED__, + const void *key __UNUSED__, void *data, void *fdata); static int _mod_list_sort (const void *data1, const void *data2); static void _list_widget_load (Evas_Object *obj, Eina_List *list); static void _avail_list_cb_change (void *data, Evas_Object *obj); static void _load_list_cb_change (void *data, Evas_Object *obj); static void _unselect_all_modules (void); -static Evas_Bool _mod_hash_unselect (const Evas_Hash *hash __UNUSED__, - const void *key __UNUSED__, +static Eina_Bool _mod_hash_unselect (const Eina_Hash *hash __UNUSED__, + const void *key __UNUSED__, void *data, void *fdata __UNUSED__); static void _select_all_modules (Evas_Object *obj, void *data); static void _btn_cb_unload (void *data, void *data2); static void _btn_cb_load (void *data, void *data2); -static Evas_Bool _mod_hash_load (const Evas_Hash *hash __UNUSED__, - const void *key __UNUSED__, +static Eina_Bool _mod_hash_load (const Eina_Hash *hash __UNUSED__, + const void *key __UNUSED__, void *data, void *fdata __UNUSED__); -static Evas_Bool _mod_hash_unload (const Evas_Hash *hash __UNUSED__, - const void *key __UNUSED__, +static Eina_Bool _mod_hash_unload (const Eina_Hash *hash __UNUSED__, + const void *key __UNUSED__, void *data, void *fdata __UNUSED__); static void _enable_modules (int enable); -static Evas_Bool _enable_modules_types_enable (const Evas_Hash *hash __UNUSED__, +static Eina_Bool _enable_modules_types_enable (const Eina_Hash *hash __UNUSED__, const void *key __UNUSED__, void *data, void *fdata); -static Evas_Bool _enable_modules_types_disable (const Evas_Hash *hash __UNUSED__, +static Eina_Bool _enable_modules_types_disable (const Eina_Hash *hash __UNUSED__, const void *key __UNUSED__, void *data, void *fdata); /* local variables */ -static Evas_Hash *types_hash = NULL; +static Eina_Hash *types_hash = NULL; EAPI E_Config_Dialog * -e_int_config_modules(E_Container *con, const char *params __UNUSED__) +e_int_config_modules(E_Container *con, const char *params __UNUSED__) { E_Config_Dialog *cfd = NULL; E_Config_Dialog_View *v = NULL; @@ -159,20 +159,20 @@ _fill_data(E_Config_Dialog_Data *cfdata) if (mdirs) e_path_dir_list_free(mdirs); } -static void -_free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata) +static void +_free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata) { - if (types_hash) + if (types_hash) { - evas_hash_foreach(types_hash, _types_hash_cb_free, NULL); - evas_hash_free(types_hash); + eina_hash_foreach(types_hash, _types_hash_cb_free, NULL); + eina_hash_free(types_hash); types_hash = NULL; } E_FREE(cfdata); } static Evas_Object * -_basic_create(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata) +_basic_create(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata) { Evas_Object *o, *of, *ol; @@ -215,30 +215,31 @@ _basic_create(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata) return o; } -static void -_fill_type_hash(void) +static void +_fill_type_hash(void) { int i = 0; /* create the inital hash based on predefined list of types */ - for (i = 0; _types[i].name; i++) + for (i = 0; _types[i].name; i++) { CFType *cft = NULL; if (!_types[i].key) continue; - if (evas_hash_find(types_hash, _types[i].key)) continue; + if (eina_hash_find(types_hash, _types[i].key)) continue; cft = E_NEW(CFType, 1); if (!cft) continue; cft->key = eina_stringshare_add(_types[i].key); cft->name = eina_stringshare_add(_types[i].name); cft->icon = eina_stringshare_add(_types[i].icon); - types_hash = evas_hash_direct_add(types_hash, cft->key, cft); + if (!types_hash) types_hash = eina_hash_string_superfast_new(NULL); + eina_hash_direct_add(types_hash, cft->key, cft); } } -static void -_load_modules(const char *dir) +static void +_load_modules(const char *dir) { Ecore_List *files = NULL; char *mod = NULL; @@ -262,15 +263,15 @@ _load_modules(const char *dir) if (!(desk = efreet_desktop_get(buf))) continue; /* does the ModuleType exist in desktop? */ - if (desk->x) - type = ecore_hash_get(desk->x, "X-Enlightenment-ModuleType"); + if (desk->x) + type = eina_hash_find(desk->x, "X-Enlightenment-ModuleType"); if (!type) type = eina_stringshare_add("shelf"); /* do we have this module already in it's type hash ? */ - cft = evas_hash_find(types_hash, type); + cft = eina_hash_find(types_hash, type); if (cft) { - if (cft->modules && evas_hash_find(cft->modules, mod)) + if (cft->modules && eina_hash_find(cft->modules, mod)) { if ((!desk->x) && (type)) eina_stringshare_del(type); if (desk) efreet_desktop_free(desk); @@ -290,7 +291,8 @@ _load_modules(const char *dir) snprintf(buf, sizeof(buf), "enlightenment/%s", type); if (e_util_edje_icon_check(buf)) cft->icon = eina_stringshare_add(buf); - types_hash = evas_hash_direct_add(types_hash, cft->key, cft); + if (!types_hash) types_hash = eina_hash_string_superfast_new(NULL); + eina_hash_direct_add(types_hash, cft->key, cft); } /* module not in it's type hash, add */ @@ -300,20 +302,21 @@ _load_modules(const char *dir) if (desk->name) cfm->name = eina_stringshare_add(desk->name); if (desk->icon) cfm->icon = eina_stringshare_add(desk->icon); if (desk->comment) cfm->comment = eina_stringshare_add(desk->comment); - if (desk->orig_path) + if (desk->orig_path) cfm->orig_path = eina_stringshare_add(desk->orig_path); if ((!desk->x) && (type)) eina_stringshare_del(type); efreet_desktop_free(desk); if (e_module_find(mod)) cfm->enabled = 1; - cft->modules = evas_hash_direct_add(cft->modules, cfm->short_name, cfm); + if (!cft->modules) cft->modules = eina_hash_string_superfast_new(NULL); + eina_hash_direct_add(cft->modules, cfm->short_name, cfm); } free(mod); if (files) ecore_list_destroy(files); } -static void -_fill_list(Evas_Object *obj, int enabled) +static void +_fill_list(Evas_Object *obj, int enabled) { Evas *evas; Evas_Coord w; @@ -325,12 +328,12 @@ _fill_list(Evas_Object *obj, int enabled) e_widget_ilist_freeze(obj); e_widget_ilist_clear(obj); - if (types_hash) + if (types_hash) { if (!enabled) - evas_hash_foreach(types_hash, _fill_list_types_avail, obj); + eina_hash_foreach(types_hash, _fill_list_types_avail, obj); else - evas_hash_foreach(types_hash, _fill_list_types_load, obj); + eina_hash_foreach(types_hash, _fill_list_types_load, obj); } e_widget_ilist_go(obj); @@ -341,8 +344,8 @@ _fill_list(Evas_Object *obj, int enabled) evas_event_thaw(evas); } -static Evas_Bool -_fill_list_types_avail(const Evas_Hash *hash __UNUSED__, +static Eina_Bool +_fill_list_types_avail(const Eina_Hash *hash __UNUSED__, const void *key __UNUSED__, void *data, void *fdata) { CFType *cft; @@ -354,8 +357,8 @@ _fill_list_types_avail(const Evas_Hash *hash __UNUSED__, return _fill_list_types(obj, cft, 0); } -static Evas_Bool -_fill_list_types_load(const Evas_Hash *hash __UNUSED__, +static Eina_Bool +_fill_list_types_load(const Eina_Hash *hash __UNUSED__, const void *key __UNUSED__, void *data, void *fdata) { CFType *cft; @@ -367,7 +370,7 @@ _fill_list_types_load(const Evas_Hash *hash __UNUSED__, return _fill_list_types(obj, cft, 1); } -static Evas_Bool +static Eina_Bool _fill_list_types(Evas_Object *obj, CFType *cft, int enabled) { Evas *evas; @@ -380,13 +383,13 @@ _fill_list_types(Evas_Object *obj, CFType *cft, int enabled) if (cft->modules) { if (!enabled) - evas_hash_foreach(cft->modules, _mod_hash_avail_list, &l); + eina_hash_foreach(cft->modules, _mod_hash_avail_list, &l); else - evas_hash_foreach(cft->modules, _mod_hash_load_list, &l); + eina_hash_foreach(cft->modules, _mod_hash_load_list, &l); } if (l) count = eina_list_count(l); - else return 1; + else return EINA_TRUE; /* We have at least one, append header */ if (cft->icon) @@ -408,12 +411,12 @@ _fill_list_types(Evas_Object *obj, CFType *cft, int enabled) l = NULL; } - return 1; + return EINA_TRUE; } -static Evas_Bool -_types_hash_cb_free(const Evas_Hash *hash __UNUSED__, const void *key __UNUSED__, - void *data, void *fdata __UNUSED__) +static Eina_Bool +_types_hash_cb_free(const Eina_Hash *hash __UNUSED__, const void *key __UNUSED__, + void *data, void *fdata __UNUSED__) { CFType *type = NULL; @@ -421,19 +424,19 @@ _types_hash_cb_free(const Evas_Hash *hash __UNUSED__, const void *key __UNUSED__ if (type->key) eina_stringshare_del(type->key); if (type->name) eina_stringshare_del(type->name); if (type->icon) eina_stringshare_del(type->icon); - if (type->modules) + if (type->modules) { - evas_hash_foreach(type->modules, _mod_hash_cb_free, NULL); - evas_hash_free(type->modules); + eina_hash_foreach(type->modules, _mod_hash_cb_free, NULL); + eina_hash_free(type->modules); type->modules = NULL; } E_FREE(type); - return 1; + return EINA_TRUE; } -static Evas_Bool -_mod_hash_cb_free(const Evas_Hash *hash __UNUSED__, const void *key __UNUSED__, - void *data, void *fdata __UNUSED__) +static Eina_Bool +_mod_hash_cb_free(const Eina_Hash *hash __UNUSED__, const void *key __UNUSED__, + void *data, void *fdata __UNUSED__) { CFModule *mod = NULL; @@ -444,12 +447,12 @@ _mod_hash_cb_free(const Evas_Hash *hash __UNUSED__, const void *key __UNUSED__, if (mod->comment) eina_stringshare_del(mod->comment); if (mod->orig_path) eina_stringshare_del(mod->orig_path); E_FREE(mod); - return 1; + return EINA_TRUE; } -static Evas_Bool -_mod_hash_avail_list(const Evas_Hash *hash __UNUSED__, const void *key __UNUSED__, - void *data, void *fdata) +static Eina_Bool +_mod_hash_avail_list(const Eina_Hash *hash __UNUSED__, const void *key __UNUSED__, + void *data, void *fdata) { Eina_List **l; CFModule *mod = NULL; @@ -458,12 +461,12 @@ _mod_hash_avail_list(const Evas_Hash *hash __UNUSED__, const void *key __UNUSED_ if ((!mod) || (mod->enabled)) return 1; l = fdata; *l = eina_list_append(*l, mod); - return 1; + return EINA_TRUE; } -static Evas_Bool -_mod_hash_load_list(const Evas_Hash *hash __UNUSED__, const void *key __UNUSED__, - void *data, void *fdata) +static Eina_Bool +_mod_hash_load_list(const Eina_Hash *hash __UNUSED__, const void *key __UNUSED__, + void *data, void *fdata) { Eina_List **l; CFModule *mod = NULL; @@ -472,11 +475,11 @@ _mod_hash_load_list(const Evas_Hash *hash __UNUSED__, const void *key __UNUSED__ if ((!mod) || (!mod->enabled)) return 1; l = fdata; *l = eina_list_append(*l, mod); - return 1; + return EINA_TRUE; } -static int -_mod_list_sort(const void *data1, const void *data2) +static int +_mod_list_sort(const void *data1, const void *data2) { const CFModule *m1, *m2; @@ -486,15 +489,15 @@ _mod_list_sort(const void *data1, const void *data2) } /* nice generic function to load an ilist with items */ -static void -_list_widget_load(Evas_Object *obj, Eina_List *list) +static void +_list_widget_load(Evas_Object *obj, Eina_List *list) { Evas *evas; Eina_List *ml = NULL; if ((!obj) || (!list)) return; evas = evas_object_evas_get(obj); - for (ml = list; ml; ml = ml->next) + for (ml = list; ml; ml = ml->next) { CFModule *mod = NULL; Evas_Object *ic = NULL; @@ -502,7 +505,7 @@ _list_widget_load(Evas_Object *obj, Eina_List *list) char buf[4096]; if (!(mod = ml->data)) continue; - if (mod->orig_path) + if (mod->orig_path) { path = ecore_file_dir_get(mod->orig_path); snprintf(buf, sizeof(buf), "%s/%s.edj", path, mod->icon); @@ -516,8 +519,8 @@ _list_widget_load(Evas_Object *obj, Eina_List *list) } } -static void -_avail_list_cb_change(void *data, Evas_Object *obj) +static void +_avail_list_cb_change(void *data, Evas_Object *obj) { E_Config_Dialog_Data *cfdata = NULL; @@ -541,8 +544,8 @@ _avail_list_cb_change(void *data, Evas_Object *obj) e_widget_disabled_set(cfdata->b_load, 0); } -static void -_load_list_cb_change(void *data, Evas_Object *obj) +static void +_load_list_cb_change(void *data, Evas_Object *obj) { E_Config_Dialog_Data *cfdata = NULL; @@ -566,28 +569,28 @@ _load_list_cb_change(void *data, Evas_Object *obj) e_widget_disabled_set(cfdata->b_unload, 0); } -static void -_unselect_all_modules(void) +static void +_unselect_all_modules(void) { int i = 0; if (!types_hash) return; /* loop types, getting all modules */ - for (i = 0; _types[i].name; i++) + for (i = 0; _types[i].name; i++) { CFType *cft = NULL; if (!_types[i].key) continue; - cft = evas_hash_find(types_hash, _types[i].key); + cft = eina_hash_find(types_hash, _types[i].key); if ((!cft) || (!cft->modules)) continue; - evas_hash_foreach(cft->modules, _mod_hash_unselect, NULL); + eina_hash_foreach(cft->modules, _mod_hash_unselect, NULL); } } -static Evas_Bool -_mod_hash_unselect(const Evas_Hash *hash __UNUSED__, const void *key __UNUSED__, - void *data, void *fdata __UNUSED__) +static Eina_Bool +_mod_hash_unselect(const Eina_Hash *hash __UNUSED__, const void *key __UNUSED__, + void *data, void *fdata __UNUSED__) { CFModule *mod = NULL; @@ -596,15 +599,15 @@ _mod_hash_unselect(const Evas_Hash *hash __UNUSED__, const void *key __UNUSED__, return 1; } -static void -_select_all_modules(Evas_Object *obj, void *data) +static void +_select_all_modules(Evas_Object *obj, void *data) { Eina_List *l = NULL; E_Config_Dialog_Data *cfdata = NULL; int i = 0; if (!(cfdata = data)) return; - for (i = 0, l = e_widget_ilist_items_get(obj); l; l = l->next, i++) + for (i = 0, l = e_widget_ilist_items_get(obj); l; l = l->next, i++) { E_Ilist_Item *item = NULL; CFModule *mod = NULL; @@ -616,13 +619,13 @@ _select_all_modules(Evas_Object *obj, void *data) if (mod->comment) e_widget_textblock_markup_set(cfdata->o_desc, mod->comment); else - e_widget_textblock_markup_set(cfdata->o_desc, + e_widget_textblock_markup_set(cfdata->o_desc, _("Description: Unavailable")); } } -static void -_btn_cb_unload(void *data, void *data2) +static void +_btn_cb_unload(void *data, void *data2) { E_Config_Dialog_Data *cfdata = NULL; int sel = -1; @@ -636,18 +639,18 @@ _btn_cb_unload(void *data, void *data2) e_widget_disabled_set(cfdata->b_unload, 1); e_widget_textblock_markup_set(cfdata->o_desc, _("Description: Unavailable")); - /* using a total reload here as it's simpler than parsing the list(s), + /* using a total reload here as it's simpler than parsing the list(s), * finding what was selected, removing it, checking for headers, etc */ _fill_list(cfdata->l_avail, 0); _fill_list(cfdata->l_loaded, 1); - /* move the selection down one if possible. Ilist itself will check + /* move the selection down one if possible. Ilist itself will check * for headers, etc, etc */ e_widget_ilist_selected_set(cfdata->l_loaded, sel); } -static void -_btn_cb_load(void *data, void *data2) +static void +_btn_cb_load(void *data, void *data2) { E_Config_Dialog_Data *cfdata = NULL; int sel = -1; @@ -661,29 +664,29 @@ _btn_cb_load(void *data, void *data2) e_widget_disabled_set(cfdata->b_load, 1); e_widget_textblock_markup_set(cfdata->o_desc, _("Description: Unavailable")); - /* using a total reload here as it's simpler than parsing the list(s), + /* using a total reload here as it's simpler than parsing the list(s), * finding what was selected, removing it, checking for headers, etc */ _fill_list(cfdata->l_avail, 0); _fill_list(cfdata->l_loaded, 1); - /* move the selection down one if possible. Ilist itself will check + /* move the selection down one if possible. Ilist itself will check * for headers, etc, etc */ e_widget_ilist_selected_set(cfdata->l_avail, sel); } -static void -_enable_modules(int enable) +static void +_enable_modules(int enable) { if (!types_hash) return; if (enable) - evas_hash_foreach(types_hash, _enable_modules_types_enable, NULL); + eina_hash_foreach(types_hash, _enable_modules_types_enable, NULL); else - evas_hash_foreach(types_hash, _enable_modules_types_disable, NULL); + eina_hash_foreach(types_hash, _enable_modules_types_disable, NULL); } -static Evas_Bool -_enable_modules_types_enable(const Evas_Hash *hash __UNUSED__, +static Eina_Bool +_enable_modules_types_enable(const Eina_Hash *hash __UNUSED__, const void *key __UNUSED__, void *data, void *fdata) { @@ -691,12 +694,12 @@ _enable_modules_types_enable(const Evas_Hash *hash __UNUSED__, cft = data; if (cft && cft->modules) - evas_hash_foreach(cft->modules, _mod_hash_load, NULL); + eina_hash_foreach(cft->modules, _mod_hash_load, NULL); return 1; } -static Evas_Bool -_enable_modules_types_disable(const Evas_Hash *hash __UNUSED__, +static Eina_Bool +_enable_modules_types_disable(const Eina_Hash *hash __UNUSED__, const void *key __UNUSED__, void *data, void *fdata) { @@ -704,13 +707,13 @@ _enable_modules_types_disable(const Evas_Hash *hash __UNUSED__, cft = data; if (cft && cft->modules) - evas_hash_foreach(cft->modules, _mod_hash_unload, NULL); + eina_hash_foreach(cft->modules, _mod_hash_unload, NULL); return 1; } -static Evas_Bool -_mod_hash_load(const Evas_Hash *hash __UNUSED__, const void *key __UNUSED__, - void *data, void *fdata __UNUSED__) +static Eina_Bool +_mod_hash_load(const Eina_Hash *hash __UNUSED__, const void *key __UNUSED__, + void *data, void *fdata __UNUSED__) { CFModule *mod = NULL; E_Module *module = NULL; @@ -725,9 +728,9 @@ _mod_hash_load(const Evas_Hash *hash __UNUSED__, const void *key __UNUSED__, return 1; } -static Evas_Bool -_mod_hash_unload(const Evas_Hash *hash __UNUSED__, const void *key __UNUSED__, - void *data, void *fdata __UNUSED__) +static Eina_Bool +_mod_hash_unload(const Eina_Hash *hash __UNUSED__, const void *key __UNUSED__, + void *data, void *fdata __UNUSED__) { CFModule *mod = NULL; E_Module *module = NULL; diff --git a/src/bin/e_int_menus.c b/src/bin/e_int_menus.c index f19b37823a..d349fb20f1 100644 --- a/src/bin/e_int_menus.c +++ b/src/bin/e_int_menus.c @@ -65,7 +65,7 @@ static void _e_int_menus_items_del_hook (void *obj); static void _e_int_menus_item_label_set (Efreet_Menu *entry, E_Menu_Item *mi); /* local subsystem globals */ -static Evas_Hash *_e_int_menus_augmentation = NULL; +static Eina_Hash *_e_int_menus_augmentation = NULL; /* externally accessible functions */ EAPI E_Menu * @@ -81,20 +81,20 @@ e_int_menus_main_new(void) m = e_menu_new(); e_menu_title_set(m, _("Main")); dat->menu = m; - e_object_data_set(E_OBJECT(m), dat); + e_object_data_set(E_OBJECT(m), dat); e_object_del_attach_func_set(E_OBJECT(m), _e_int_menus_main_del_hook); e_menu_category_set(m, "main"); - l = evas_hash_find(_e_int_menus_augmentation, "main/0"); + l = eina_hash_find(_e_int_menus_augmentation, "main/0"); if (l) _e_int_menus_augmentation_add(m, l); - if (e_config->menu_favorites_show) + if (e_config->menu_favorites_show) { subm = e_int_menus_favorite_apps_new(); if (subm) { - dat->apps = subm; + dat->apps = subm; mi = e_menu_item_new(m); e_menu_item_label_set(mi, _("Favorite Applications")); e_util_menu_item_edje_icon_set(mi, "enlightenment/favorites"); @@ -112,13 +112,13 @@ e_int_menus_main_new(void) e_menu_item_submenu_set(mi, subm); } - l = evas_hash_find(_e_int_menus_augmentation, "main/1"); + l = eina_hash_find(_e_int_menus_augmentation, "main/1"); if (l) _e_int_menus_augmentation_add(m, l); mi = e_menu_item_new(m); e_menu_item_separator_set(mi, 1); - l = evas_hash_find(_e_int_menus_augmentation, "main/2"); + l = eina_hash_find(_e_int_menus_augmentation, "main/2"); if (l) _e_int_menus_augmentation_add(m, l); subm = e_int_menus_desktops_new(); @@ -145,13 +145,13 @@ e_int_menus_main_new(void) e_menu_item_submenu_set(mi, subm); */ - l = evas_hash_find(_e_int_menus_augmentation, "main/3"); + l = eina_hash_find(_e_int_menus_augmentation, "main/3"); if (l) _e_int_menus_augmentation_add(m, l); mi = e_menu_item_new(m); e_menu_item_separator_set(mi, 1); - l = evas_hash_find(_e_int_menus_augmentation, "main/4"); + l = eina_hash_find(_e_int_menus_augmentation, "main/4"); if (l) _e_int_menus_augmentation_add(m, l); subm = e_menu_new(); @@ -172,13 +172,13 @@ e_int_menus_main_new(void) e_util_menu_item_edje_icon_set(mi, "enlightenment/themes"); e_menu_item_callback_set(mi, _e_int_menus_themes_about, NULL); - l = evas_hash_find(_e_int_menus_augmentation, "main/5"); + l = eina_hash_find(_e_int_menus_augmentation, "main/5"); if (l) _e_int_menus_augmentation_add(m, l); mi = e_menu_item_new(subm); e_menu_item_separator_set(mi, 1); - l = evas_hash_find(_e_int_menus_augmentation, "main/6"); + l = eina_hash_find(_e_int_menus_augmentation, "main/6"); if (l) _e_int_menus_augmentation_add(m, l); mi = e_menu_item_new(subm); @@ -191,13 +191,13 @@ e_int_menus_main_new(void) e_util_menu_item_edje_icon_set(mi, "enlightenment/exit"); e_menu_item_callback_set(mi, _e_int_menus_main_exit, NULL); - l = evas_hash_find(_e_int_menus_augmentation, "main/7"); + l = eina_hash_find(_e_int_menus_augmentation, "main/7"); if (l) _e_int_menus_augmentation_add(m, l); mi = e_menu_item_new(m); e_menu_item_separator_set(mi, 1); - l = evas_hash_find(_e_int_menus_augmentation, "main/8"); + l = eina_hash_find(_e_int_menus_augmentation, "main/8"); if (l) _e_int_menus_augmentation_add(m, l); subm = e_int_menus_config_new(); @@ -207,7 +207,7 @@ e_int_menus_main_new(void) e_util_menu_item_edje_icon_set(mi, "enlightenment/configuration"); e_menu_item_submenu_set(mi, subm); - l = evas_hash_find(_e_int_menus_augmentation, "main/9"); + l = eina_hash_find(_e_int_menus_augmentation, "main/9"); if (l) _e_int_menus_augmentation_add(m, l); l = evas_hash_find(_e_int_menus_augmentation, "main/10"); @@ -290,7 +290,7 @@ e_int_menus_favorite_apps_new(void) const char *homedir; homedir = e_user_homedir_get(); - snprintf(buf, sizeof(buf), + snprintf(buf, sizeof(buf), "%s/.e/e/applications/menu/favorite.menu", homedir); if (ecore_file_exists(buf)) m = e_int_menus_apps_new(buf); @@ -355,16 +355,14 @@ e_int_menus_menu_augmentation_add(const char *menu, maug->del.func = func_del; maug->del.data = data_del; - l = evas_hash_find(_e_int_menus_augmentation, menu); - if (l) - { - _e_int_menus_augmentation = - evas_hash_del(_e_int_menus_augmentation, menu, l); - } + l = eina_hash_find(_e_int_menus_augmentation, menu); + if (l) + eina_hash_del(_e_int_menus_augmentation, menu, l); l = eina_list_append(l, maug); - _e_int_menus_augmentation = - evas_hash_add(_e_int_menus_augmentation, menu, l); + if (!_e_int_menus_augmentation) + _e_int_menus_augmentation = eina_hash_string_superfast_new(NULL); + eina_hash_add(_e_int_menus_augmentation, menu, l); return maug; } @@ -374,22 +372,28 @@ e_int_menus_menu_augmentation_del(const char *menu, E_Int_Menu_Augmentation *mau { Eina_List *l = NULL; - l = evas_hash_find(_e_int_menus_augmentation, menu); + l = eina_hash_find(_e_int_menus_augmentation, menu); if (l) { /* * We should always add the list to the hash, in case the list * becomes empty, or the first element is removed. */ - _e_int_menus_augmentation = - evas_hash_del(_e_int_menus_augmentation, menu, l); + eina_hash_del(_e_int_menus_augmentation, menu, l); l = eina_list_remove(l, maug); - if (l) - { - _e_int_menus_augmentation = - evas_hash_add(_e_int_menus_augmentation, menu, l); - } + if (l) + { + eina_hash_add(_e_int_menus_augmentation, menu, l); + } + else + { + if (!eina_hash_population(_e_int_menus_augmentation)) + { + eina_hash_free(_e_int_menus_augmentation); + _e_int_menus_augmentation = NULL; + } + } } free(maug); } @@ -414,18 +418,18 @@ _e_int_menus_main_del_hook(void *obj) if (dat->lost_clients) e_object_del(E_OBJECT(dat->lost_clients)); free(dat); } - _e_int_menus_augmentation_del(m, evas_hash_find(_e_int_menus_augmentation, "main/0")); - _e_int_menus_augmentation_del(m, evas_hash_find(_e_int_menus_augmentation, "main/1")); - _e_int_menus_augmentation_del(m, evas_hash_find(_e_int_menus_augmentation, "main/2")); - _e_int_menus_augmentation_del(m, evas_hash_find(_e_int_menus_augmentation, "main/3")); - _e_int_menus_augmentation_del(m, evas_hash_find(_e_int_menus_augmentation, "main/4")); - _e_int_menus_augmentation_del(m, evas_hash_find(_e_int_menus_augmentation, "main/5")); - _e_int_menus_augmentation_del(m, evas_hash_find(_e_int_menus_augmentation, "main/6")); - _e_int_menus_augmentation_del(m, evas_hash_find(_e_int_menus_augmentation, "main/7")); - _e_int_menus_augmentation_del(m, evas_hash_find(_e_int_menus_augmentation, "main/8")); - _e_int_menus_augmentation_del(m, evas_hash_find(_e_int_menus_augmentation, "main/9")); - _e_int_menus_augmentation_del(m, evas_hash_find(_e_int_menus_augmentation, "main/10")); - _e_int_menus_augmentation_del(m, evas_hash_find(_e_int_menus_augmentation, "main/11")); + _e_int_menus_augmentation_del(m, eina_hash_find(_e_int_menus_augmentation, "main/0")); + _e_int_menus_augmentation_del(m, eina_hash_find(_e_int_menus_augmentation, "main/1")); + _e_int_menus_augmentation_del(m, eina_hash_find(_e_int_menus_augmentation, "main/2")); + _e_int_menus_augmentation_del(m, eina_hash_find(_e_int_menus_augmentation, "main/3")); + _e_int_menus_augmentation_del(m, eina_hash_find(_e_int_menus_augmentation, "main/4")); + _e_int_menus_augmentation_del(m, eina_hash_find(_e_int_menus_augmentation, "main/5")); + _e_int_menus_augmentation_del(m, eina_hash_find(_e_int_menus_augmentation, "main/6")); + _e_int_menus_augmentation_del(m, eina_hash_find(_e_int_menus_augmentation, "main/7")); + _e_int_menus_augmentation_del(m, eina_hash_find(_e_int_menus_augmentation, "main/8")); + _e_int_menus_augmentation_del(m, eina_hash_find(_e_int_menus_augmentation, "main/9")); + _e_int_menus_augmentation_del(m, eina_hash_find(_e_int_menus_augmentation, "main/10")); + _e_int_menus_augmentation_del(m, eina_hash_find(_e_int_menus_augmentation, "main/11")); } static void @@ -737,14 +741,14 @@ _e_int_menus_config_pre_cb(void *data, E_Menu *m) e_menu_pre_activate_callback_set(m, NULL, NULL); - l = evas_hash_find(_e_int_menus_augmentation, "config/0"); + l = eina_hash_find(_e_int_menus_augmentation, "config/0"); if (l) { _e_int_menus_augmentation_add(m, l); mi = e_menu_item_new(m); e_menu_item_separator_set(mi, 1); } - + if (e_configure_registry_exists("extensions/modules")) { mi = e_menu_item_new(m); @@ -753,14 +757,15 @@ _e_int_menus_config_pre_cb(void *data, E_Menu *m) e_menu_item_callback_set(mi, _e_int_menus_module_item_cb, NULL); } - l = evas_hash_find(_e_int_menus_augmentation, "config/1"); + l = eina_hash_find(_e_int_menus_augmentation, "config/1"); if (l) _e_int_menus_augmentation_add(m, l); - l = evas_hash_find(_e_int_menus_augmentation, "config/2"); + l = eina_hash_find(_e_int_menus_augmentation, "config/2"); if (l) { mi = e_menu_item_new(m); e_menu_item_separator_set(mi, 1); + _e_int_menus_augmentation_add(m, l); } @@ -773,9 +778,9 @@ _e_int_menus_config_free_hook(void *obj) E_Menu *m; m = obj; - _e_int_menus_augmentation_del(m, evas_hash_find(_e_int_menus_augmentation, "config/0")); - _e_int_menus_augmentation_del(m, evas_hash_find(_e_int_menus_augmentation, "config/1")); - _e_int_menus_augmentation_del(m, evas_hash_find(_e_int_menus_augmentation, "config/2")); + _e_int_menus_augmentation_del(m, eina_hash_find(_e_int_menus_augmentation, "config/0")); + _e_int_menus_augmentation_del(m, eina_hash_find(_e_int_menus_augmentation, "config/1")); + _e_int_menus_augmentation_del(m, eina_hash_find(_e_int_menus_augmentation, "config/2")); } static int diff --git a/src/bin/e_intl.c b/src/bin/e_intl.c index ee6b889dff..53a8b268a7 100644 --- a/src/bin/e_intl.c +++ b/src/bin/e_intl.c @@ -41,13 +41,13 @@ static Eina_List *_e_intl_language_dir_scan(const char *dir); static int _e_intl_language_list_find(Eina_List *language_list, char *language); /* Locale Validation and Discovery */ -static Evas_Hash *_e_intl_locale_alias_hash_get(void); +static Eina_Hash *_e_intl_locale_alias_hash_get(void); static char *_e_intl_locale_alias_get(const char *language); static Eina_List *_e_intl_locale_system_locales_get(void); static Eina_List *_e_intl_locale_search_order_get(const char *locale); static int _e_intl_locale_validate(const char *locale); -static void _e_intl_locale_hash_free(Evas_Hash *language_hash); -static Evas_Bool _e_intl_locale_hash_free_cb(const Evas_Hash *hash, const void *key, void *data, void *fdata); +static void _e_intl_locale_hash_free(Eina_Hash *language_hash); +static Evas_Bool _e_intl_locale_hash_free_cb(const Eina_Hash *hash, const void *key, void *data, void *fdata); /* Input Method Configuration and Management */ static int _e_intl_cb_exit(void *data, int type, void *event); @@ -459,15 +459,15 @@ _e_intl_cb_exit(void *data, int type, void *event) } static void -_e_intl_locale_hash_free(Evas_Hash *locale_hash) +_e_intl_locale_hash_free(Eina_Hash *locale_hash) { if (!locale_hash) return; - evas_hash_foreach(locale_hash, _e_intl_locale_hash_free_cb, NULL); - evas_hash_free(locale_hash); + eina_hash_foreach(locale_hash, _e_intl_locale_hash_free_cb, NULL); + eina_hash_free(locale_hash); } -static Evas_Bool -_e_intl_locale_hash_free_cb(const Evas_Hash *hash __UNUSED__, const void *key __UNUSED__, void *data, void *fdata __UNUSED__) +static Eina_Bool +_e_intl_locale_hash_free_cb(const Eina_Hash *hash __UNUSED__, const void *key __UNUSED__, void *data, void *fdata __UNUSED__) { free(data); return 1; @@ -576,7 +576,7 @@ _e_intl_language_dir_scan(const char *dir) static char * _e_intl_locale_alias_get(const char *language) { - Evas_Hash *alias_hash; + Eina_Hash *alias_hash; char *alias; char *lower_language; char *noenc_language; @@ -594,7 +594,7 @@ _e_intl_locale_alias_get(const char *language) lower_language[i] = tolower(language[i]); lower_language[i] = 0; - alias = evas_hash_find(alias_hash, lower_language); + alias = eina_hash_find(alias_hash, lower_language); free(lower_language); if (alias) @@ -607,12 +607,12 @@ _e_intl_locale_alias_get(const char *language) return alias; } -static Evas_Hash * +static Eina_Hash * _e_intl_locale_alias_hash_get(void) { Eina_List *next; Eina_List *dir_list; - Evas_Hash *alias_hash; + Eina_Hash *alias_hash; dir_list = e_path_dir_list_get(path_messages); alias_hash = NULL; @@ -639,10 +639,11 @@ _e_intl_locale_alias_hash_get(void) continue; /* skip dupes */ - if (evas_hash_find(alias_hash, alias)) + if (eina_hash_find(alias_hash, alias)) continue; - alias_hash = evas_hash_add(alias_hash, alias, strdup(locale)); + if (!alias_hash) alias_hash = eina_hash_string_superfast_new(NULL); + eina_hash_add(alias_hash, alias, strdup(locale)); } fclose (f); } diff --git a/src/bin/e_ipc_codec.c b/src/bin/e_ipc_codec.c index 209b44fa76..b25eccf692 100644 --- a/src/bin/e_ipc_codec.c +++ b/src/bin/e_ipc_codec.c @@ -28,15 +28,27 @@ static Eet_Data_Descriptor *_e_ipc_3int_3str_list_edd = NULL; static Eet_Data_Descriptor *_e_ipc_str_4int_edd = NULL; static Eet_Data_Descriptor *_e_ipc_str_4int_list_edd = NULL; +static void * +_e_ipc_codec_eina_hash_add(void *hash, const void *key, void *data) +{ + Eina_Hash *result = hash; + + if (!result) result = eina_hash_string_superfast_new(NULL); + if (!result) return NULL; + + eina_hash_add(result, key, data); + return result; +} + #define E_IPC_DD_NEW(str, typ) \ eet_data_descriptor_new(str, sizeof(typ), \ (void *(*) (void *))eina_list_next, \ (void *(*) (void *, void *))eina_list_append, \ (void *(*) (void *))eina_list_data_get, \ (void *(*) (void *))eina_list_free, \ - (void (*) (void *, int (*) (void *, const char *, void *, void *), void *))evas_hash_foreach, \ - (void *(*) (void *, const char *, void *))evas_hash_add, \ - (void (*) (void *))evas_hash_free) + (void (*) (void *, int (*) (void *, const char *, void *, void *), void *))eina_hash_foreach, \ + (void *(*) (void *, const char *, void *))_e_ipc_codec_eina_hash_add, \ + (void (*) (void *))eina_hash_free) /* externally accessible functions */ EAPI int diff --git a/src/bin/e_manager.c b/src/bin/e_manager.c index 8b16bfe33d..6b5ad9a74a 100644 --- a/src/bin/e_manager.c +++ b/src/bin/e_manager.c @@ -15,7 +15,7 @@ static int _e_manager_cb_ping(void *data, int ev_type, void *ev); static int _e_manager_cb_screensaver_notify(void *data, int ev_type, void *ev); static int _e_manager_cb_client_message(void *data, int ev_type, void *ev); -static Evas_Bool _e_manager_frame_extents_free_cb(const Evas_Hash *hash __UNUSED__, +static Eina_Bool _e_manager_frame_extents_free_cb(const Eina_Hash *hash __UNUSED__, const void *key __UNUSED__, void *data, void *fdata __UNUSED__); static E_Manager *_e_manager_get_for_root(Ecore_X_Window root); @@ -44,13 +44,14 @@ struct _Frame_Extents }; static Eina_List *managers = NULL; -static Evas_Hash *frame_extents = NULL; - +static Eina_Hash *frame_extents = NULL; + /* externally accessible functions */ EAPI int e_manager_init(void) { ecore_x_screensaver_event_listen_set(1); + frame_extents = eina_hash_string_superfast_new(NULL); return 1; } @@ -68,8 +69,8 @@ e_manager_shutdown(void) } if (frame_extents) { - evas_hash_foreach(frame_extents, _e_manager_frame_extents_free_cb, NULL); - evas_hash_free(frame_extents); + eina_hash_foreach(frame_extents, _e_manager_frame_extents_free_cb, NULL); + eina_hash_free(frame_extents); frame_extents = NULL; } return 1; @@ -712,7 +713,7 @@ _e_manager_cb_frame_extents_request(void *data, int ev_type __UNUSED__, void *ev free(state); } - extents = evas_hash_find(frame_extents, key); + extents = eina_hash_find(frame_extents, key); if (!extents) { extents = E_NEW(Frame_Extents, 1); @@ -751,7 +752,7 @@ _e_manager_cb_frame_extents_request(void *data, int ev_type __UNUSED__, void *ev extents->b = 0; } evas_object_del(o); - frame_extents = evas_hash_add(frame_extents, key, extents); + eina_hash_add(frame_extents, key, extents); } } @@ -852,12 +853,12 @@ _e_manager_cb_client_message(void *data, int ev_type, void *ev) } } } - + return 1; } -static Evas_Bool -_e_manager_frame_extents_free_cb(const Evas_Hash *hash __UNUSED__, const void *key __UNUSED__, +static Eina_Bool +_e_manager_frame_extents_free_cb(const Eina_Hash *hash __UNUSED__, const void *key __UNUSED__, void *data, void *fdata __UNUSED__) { free(data); diff --git a/src/bin/e_menu.c b/src/bin/e_menu.c index 74c8e2df40..c3c07be3ac 100644 --- a/src/bin/e_menu.c +++ b/src/bin/e_menu.c @@ -86,14 +86,14 @@ static int _e_menu_cb_scroll_animator (void *data); static int _e_menu_cb_window_shape (void *data, int ev_type, void *ev); static void _e_menu_cb_item_submenu_post_default (void *data, E_Menu *m, E_Menu_Item *mi); -static Evas_Bool _e_menu_categories_free_cb(const Evas_Hash *hash, const void *key, void *data, void *fdata); +static Evas_Bool _e_menu_categories_free_cb(const Eina_Hash *hash, const void *key, void *data, void *fdata); /* local subsystem globals */ static Ecore_X_Window _e_menu_win = 0; static Eina_List *_e_active_menus = NULL; static E_Menu_Item *_e_active_menu_item = NULL; -/*static Evas_Hash *_e_menu_category_items = NULL;*/ -static Evas_Hash *_e_menu_categories = NULL; +/*static Eina_Hash *_e_menu_category_items = NULL;*/ +static Eina_Hash *_e_menu_categories = NULL; static Ecore_X_Time _e_menu_activate_time = 0; static int _e_menu_activate_floating = 0; static int _e_menu_activate_maybe_drag = 0; @@ -124,6 +124,7 @@ e_menu_init(void) _e_menu_mouse_move_handler = ecore_event_handler_add(ECORE_X_EVENT_MOUSE_MOVE, _e_menu_cb_mouse_move, NULL); _e_menu_mouse_wheel_handler = ecore_event_handler_add(ECORE_X_EVENT_MOUSE_WHEEL, _e_menu_cb_mouse_wheel, NULL); _e_menu_window_shape_handler = ecore_event_handler_add(ECORE_X_EVENT_WINDOW_SHAPE, _e_menu_cb_window_shape, NULL); + _e_menu_categories = eina_hash_string_superfast_new(NULL); return 1; } @@ -153,11 +154,11 @@ e_menu_shutdown(void) _e_active_menus = NULL; if (_e_menu_categories) { - evas_hash_foreach(_e_menu_categories, _e_menu_categories_free_cb, NULL); - evas_hash_free(_e_menu_categories); + eina_hash_foreach(_e_menu_categories, _e_menu_categories_free_cb, NULL); + eina_hash_free(_e_menu_categories); _e_menu_categories = NULL; } - + return 1; } @@ -438,15 +439,15 @@ EAPI void e_menu_category_data_set(char *category, void *data) { E_Menu_Category *cat; - - cat = evas_hash_find(_e_menu_categories, category); + + cat = eina_hash_find(_e_menu_categories, category); if (cat) cat->data = data; else /* if it isnt found create the new hash */ { cat = calloc(1, sizeof(E_Menu_Category)); cat->data = data; - _e_menu_categories = evas_hash_add(_e_menu_categories, category, cat); + eina_hash_add(_e_menu_categories, category, cat); } } @@ -455,12 +456,12 @@ e_menu_category_callback_add(char *category, void (*create) (E_Menu *m, void *ca { E_Menu_Category *cat; E_Menu_Category_Callback *cb = NULL; - - cat = evas_hash_find(_e_menu_categories, category); + + cat = eina_hash_find(_e_menu_categories, category); if (!cat) /* if it isnt found create the new hash */ { cat = calloc(1, sizeof(E_Menu_Category)); - _e_menu_categories = evas_hash_add(_e_menu_categories, category, cat); + eina_hash_add(_e_menu_categories, category, cat); } if (cat) { @@ -484,7 +485,7 @@ e_menu_category_callback_del(E_Menu_Category_Callback *cb) if (cb) { - cat = evas_hash_find(_e_menu_categories, cb->category); + cat = eina_hash_find(_e_menu_categories, cb->category); if (cat) cat->callbacks = eina_list_remove(cat->callbacks, cb); eina_stringshare_del(cb->category); @@ -1021,9 +1022,9 @@ _e_menu_free(E_Menu *m) { Eina_List *l, *tmp; E_Menu_Category *cat; - + /* the foreign menu items */ - cat = evas_hash_find(_e_menu_categories, m->category); + cat = eina_hash_find(_e_menu_categories, m->category); if (cat) { for (l = cat->callbacks; l; l = l->next) @@ -2875,11 +2876,11 @@ _e_menu_cb_item_submenu_post_default(void *data, E_Menu *m, E_Menu_Item *mi) static Evas_Bool -_e_menu_categories_free_cb(const Evas_Hash *hash, const void *key, void *data, void *fdata) +_e_menu_categories_free_cb(const Eina_Hash *hash, const void *key, void *data, void *fdata) { Eina_List *l; E_Menu_Category *cat; - + cat = (E_Menu_Category *) data; l = (Eina_List *) cat->callbacks; while (l) diff --git a/src/bin/e_module.c b/src/bin/e_module.c index ed24ffc0b5..5ef7982c3d 100644 --- a/src/bin/e_module.c +++ b/src/bin/e_module.c @@ -72,15 +72,15 @@ EAPI void e_module_all_load(void) { Eina_List *l; + E_Config_Module *em; + e_config->modules = eina_list_sort(e_config->modules, eina_list_count(e_config->modules), _e_module_sort_priority); - for (l = e_config->modules; l; l = l->next) + EINA_LIST_FOREACH(e_config->modules, l, em) { - E_Config_Module *em; E_Module *m; - - em = l->data; + if (!em) continue; if ((em->delayed) && (em->enabled)) { @@ -258,7 +258,8 @@ e_module_enable(E_Module *m) { Eina_List *l; E_Event_Module_Update *ev; - + E_Config_Module *em; + E_OBJECT_CHECK_RETURN(m, 0); E_OBJECT_TYPE_CHECK_RETURN(m, E_MODULE_TYPE, 0); if ((m->enabled) || (m->error)) return 0; @@ -266,21 +267,18 @@ e_module_enable(E_Module *m) if (m->data) { m->enabled = 1; - for (l = e_config->modules; l; l = l->next) + EINA_LIST_FOREACH(e_config->modules, l, em) { - E_Config_Module *em; - - em = l->data; if (!em) continue; if (!e_util_strcmp(em->name, m->name)) { em->enabled = 1; e_config_save_queue(); - + ev = E_NEW(E_Event_Module_Update, 1); ev->name = strdup(em->name); ev->enabled = 1; - ecore_event_add(E_EVENT_MODULE_UPDATE, ev, + ecore_event_add(E_EVENT_MODULE_UPDATE, ev, _e_module_event_update_free, NULL); break; } @@ -295,29 +293,27 @@ e_module_disable(E_Module *m) { E_Event_Module_Update *ev; Eina_List *l; + E_Config_Module *em; int ret; - + E_OBJECT_CHECK_RETURN(m, 0); E_OBJECT_TYPE_CHECK_RETURN(m, E_MODULE_TYPE, 0); if ((!m->enabled) || (m->error)) return 0; ret = m->func.shutdown(m); m->data = NULL; m->enabled = 0; - for (l = e_config->modules; l; l = l->next) + EINA_LIST_FOREACH(e_config->modules, l, em) { - E_Config_Module *em; - - em = l->data; if (!em) continue; if (!e_util_strcmp(em->name, m->name)) { em->enabled = 0; e_config_save_queue(); - + ev = E_NEW(E_Event_Module_Update, 1); ev->name = strdup(em->name); ev->enabled = 0; - ecore_event_add(E_EVENT_MODULE_UPDATE, ev, + ecore_event_add(E_EVENT_MODULE_UPDATE, ev, _e_module_event_update_free, NULL); break; } @@ -337,20 +333,18 @@ EAPI int e_module_save_all(void) { Eina_List *l; + E_Module *m; int ret = 1; - - for (l = _e_modules; l; l = l->next) e_object_ref(E_OBJECT(l->data)); - for (l = _e_modules; l; l = l->next) - { - E_Module *m; - - m = l->data; + + EINA_LIST_FOREACH(_e_modules, l, m) + e_object_ref(E_OBJECT(m)); + EINA_LIST_FOREACH(_e_modules, l, m) if ((m->enabled) && (!m->error)) { if (!m->func.save(m)) ret = 0; } - } - for (l = _e_modules; l; l = l->next) e_object_unref(E_OBJECT(l->data)); + EINA_LIST_FOREACH(_e_modules, l, m) + e_object_unref(E_OBJECT(m)); return ret; } @@ -358,15 +352,11 @@ EAPI E_Module * e_module_find(const char *name) { Eina_List *l; - + E_Module *m; + if (!name) return NULL; - for (l = _e_modules; l; l = l->next) - { - E_Module *m; - - m = l->data; - if (!e_util_strcmp(name, m->name)) return m; - } + EINA_LIST_FOREACH(_e_modules, l, m) + if (!e_util_strcmp(name, m->name)) return m; return NULL; } diff --git a/src/bin/e_path.c b/src/bin/e_path.c index 7fa6e4734f..6d1b832ee7 100644 --- a/src/bin/e_path.c +++ b/src/bin/e_path.c @@ -6,14 +6,14 @@ /* local subsystem functions */ static void _e_path_free(E_Path *ep); static void _e_path_cache_free(E_Path *ep); -static Evas_Bool _e_path_cache_free_cb(const Evas_Hash *hash, const void *key, void *data, void *fdata); +static Eina_Bool _e_path_cache_free_cb(const Eina_Hash *hash, const void *key, void *data, void *fdata); /* externally accessible functions */ EAPI E_Path * e_path_new(void) { E_Path *ep; - + ep = E_OBJECT_ALLOC(E_Path, E_PATH_TYPE, _e_path_free); return ep; } @@ -239,30 +239,30 @@ EAPI const char * e_path_find(E_Path *ep, const char *file) { Eina_List *l; + E_Path_Dir *epd; char *str; char buf[PATH_MAX] = ""; - + E_OBJECT_CHECK_RETURN(ep, NULL); E_OBJECT_TYPE_CHECK_RETURN(ep, E_PATH_TYPE, NULL); if (!file) return NULL; - str = evas_hash_find(ep->hash, file); + str = eina_hash_find(ep->hash, file); if (str) return eina_stringshare_add(str); /* Look in the default dir list */ - for (l = ep->default_dir_list; l; l = l->next) + EINA_LIST_FOREACH(ep->default_dir_list, l, epd) { - E_Path_Dir *epd; - - epd = l->data; if (epd->dir) { snprintf(buf, sizeof(buf), "%s/%s", epd->dir, file); if (ecore_file_exists(buf)) { - if (evas_hash_size(ep->hash) >= 512) + if (eina_hash_population(ep->hash) >= 512) _e_path_cache_free(ep); - ep->hash = evas_hash_add(ep->hash, file, - eina_stringshare_add(buf)); + if (!ep->hash) + ep->hash = eina_hash_string_superfast_new(NULL); + eina_hash_add(ep->hash, file, + eina_stringshare_add(buf)); return eina_stringshare_add(buf); } } @@ -271,17 +271,19 @@ e_path_find(E_Path *ep, const char *file) for (l = *(ep->user_dir_list); l; l = l->next) { E_Path_Dir *epd; - + epd = l->data; if (epd->dir) { snprintf(buf, sizeof(buf), "%s/%s", epd->dir, file); if (ecore_file_exists(buf)) { - if (evas_hash_size(ep->hash) >= 512) + if (eina_hash_population(ep->hash) >= 512) _e_path_cache_free(ep); - ep->hash = evas_hash_add(ep->hash, file, - eina_stringshare_add(buf)); + if (!ep->hash) + ep->hash = eina_hash_string_superfast_new(NULL); + eina_hash_add(ep->hash, file, + eina_stringshare_add(buf)); return eina_stringshare_add(buf); } } @@ -381,13 +383,13 @@ static void _e_path_cache_free(E_Path *ep) { if (!ep->hash) return; - evas_hash_foreach(ep->hash, _e_path_cache_free_cb, NULL); - evas_hash_free(ep->hash); + eina_hash_foreach(ep->hash, _e_path_cache_free_cb, NULL); + eina_hash_free(ep->hash); ep->hash = NULL; } -static Evas_Bool -_e_path_cache_free_cb(const Evas_Hash *hash __UNUSED__, const void *key __UNUSED__, void *data, void *fdata __UNUSED__) +static Eina_Bool +_e_path_cache_free_cb(const Eina_Hash *hash __UNUSED__, const void *key __UNUSED__, void *data, void *fdata __UNUSED__) { eina_stringshare_del(data); return 1; diff --git a/src/bin/e_path.h b/src/bin/e_path.h index c66b74a108..426336414e 100644 --- a/src/bin/e_path.h +++ b/src/bin/e_path.h @@ -20,9 +20,9 @@ struct _E_Path_Dir struct _E_Path { E_Object e_obj_inherit; - - Evas_Hash *hash; - + + Eina_Hash *hash; + Eina_List *default_dir_list; /* keep track of the associated e_config path */ Eina_List **user_dir_list; @@ -39,7 +39,7 @@ EAPI void e_path_user_path_append(E_Path *ep, const char *path); EAPI void e_path_user_path_prepend(E_Path *ep, const char *path); EAPI void e_path_user_path_remove(E_Path *ep, const char *path); EAPI void e_path_user_path_clear(E_Path *ep); -EAPI const char *e_path_find(E_Path *ep, const char *file); +EAPI const char *e_path_find(E_Path *ep, const char *file); EAPI void e_path_evas_append(E_Path *ep, Evas *evas); EAPI Eina_List *e_path_dir_list_get(E_Path *ep); EAPI void e_path_dir_list_free(Eina_List *dir_list); diff --git a/src/bin/e_remote_main.c b/src/bin/e_remote_main.c index 5f8ec744d6..0fc3fe189a 100644 --- a/src/bin/e_remote_main.c +++ b/src/bin/e_remote_main.c @@ -9,11 +9,11 @@ typedef struct _Opt Opt; struct _Opt { - const char *opt; - int num_param; - const char *desc; - int num_reply; - E_Ipc_Op opcode; + char *opt; + int num_param; + char *desc; + int num_reply; + E_Ipc_Op opcode; }; Opt opts[] = { diff --git a/src/bin/e_shelf.c b/src/bin/e_shelf.c index 1164613c6e..52b177f0d8 100644 --- a/src/bin/e_shelf.c +++ b/src/bin/e_shelf.c @@ -29,7 +29,7 @@ static void _e_shelf_menu_pre_cb(void *data, E_Menu *m); static void _e_shelf_edge_event_register(E_Shelf *es, int reg); static Eina_List *shelves = NULL; -static Evas_Hash *winid_shelves = NULL; +static Eina_Hash *winid_shelves = NULL; /* externally accessible functions */ EAPI int @@ -177,7 +177,8 @@ e_shelf_zone_new(E_Zone *zone, const char *name, const char *style, int popup, i e_gadcon_shelf_set(es->gadcon, es); if (popup) { - winid_shelves = evas_hash_add(winid_shelves, e_util_winid_str_get(es->popup->evas_win), es); + if (!winid_shelves) winid_shelves = eina_hash_string_superfast_new(NULL); + eina_hash_add(winid_shelves, e_util_winid_str_get(es->popup->evas_win), es); e_drop_xdnd_register_set(es->popup->evas_win, 1); e_gadcon_xdnd_window_set(es->gadcon, es->popup->evas_win); e_gadcon_dnd_window_set(es->gadcon, es->popup->evas_win); @@ -733,7 +734,12 @@ _e_shelf_free(E_Shelf *es) { _e_shelf_edge_event_register(es, 0); e_drop_xdnd_register_set(es->popup->evas_win, 0); - winid_shelves = evas_hash_del(winid_shelves, e_util_winid_str_get(es->popup->evas_win), es); + eina_hash_del(winid_shelves, e_util_winid_str_get(es->popup->evas_win), es); + if (!eina_hash_population(winid_shelves)) + { + eina_hash_free(winid_shelves); + winid_shelves = NULL; + } e_object_del(E_OBJECT(es->popup)); } free(es); diff --git a/src/bin/e_stolen.c b/src/bin/e_stolen.c index 7b6614e11c..e7740df222 100644 --- a/src/bin/e_stolen.c +++ b/src/bin/e_stolen.c @@ -11,15 +11,15 @@ struct _E_Stolen_Window int refcount; }; -static Evas_Hash *_e_stolen_windows = NULL; +static Eina_Hash *_e_stolen_windows = NULL; /* externally accessible functions */ EAPI int e_stolen_win_get(Ecore_X_Window win) { E_Stolen_Window *esw; - - esw = evas_hash_find(_e_stolen_windows, e_util_winid_str_get(win)); + + esw = eina_hash_find(_e_stolen_windows, e_util_winid_str_get(win)); if (esw) return 1; return 0; } @@ -28,8 +28,8 @@ EAPI void e_stolen_win_add(Ecore_X_Window win) { E_Stolen_Window *esw; - - esw = evas_hash_find(_e_stolen_windows, e_util_winid_str_get(win)); + + esw = eina_hash_find(_e_stolen_windows, e_util_winid_str_get(win)); if (esw) { esw->refcount++; @@ -39,7 +39,8 @@ e_stolen_win_add(Ecore_X_Window win) esw = E_NEW(E_Stolen_Window, 1); esw->win = win; esw->refcount = 1; - _e_stolen_windows = evas_hash_add(_e_stolen_windows, e_util_winid_str_get(win), esw); + if (!_e_stolen_windows) _e_stolen_windows = eina_hash_string_superfast_new(NULL); + eina_hash_add(_e_stolen_windows, e_util_winid_str_get(win), esw); } return; } @@ -48,14 +49,19 @@ EAPI void e_stolen_win_del(Ecore_X_Window win) { E_Stolen_Window *esw; - - esw = evas_hash_find(_e_stolen_windows, e_util_winid_str_get(win)); + + esw = eina_hash_find(_e_stolen_windows, e_util_winid_str_get(win)); if (esw) { esw->refcount--; if (esw->refcount == 0) { - _e_stolen_windows = evas_hash_del(_e_stolen_windows, e_util_winid_str_get(win), esw); + eina_hash_del(_e_stolen_windows, e_util_winid_str_get(win), esw); + if (!eina_hash_population(_e_stolen_windows)) + { + eina_hash_free(_e_stolen_windows); + _e_stolen_windows = NULL; + } free(esw); } } diff --git a/src/bin/e_sys_main.c b/src/bin/e_sys_main.c index f195ec3b81..41ad5bfda6 100644 --- a/src/bin/e_sys_main.c +++ b/src/bin/e_sys_main.c @@ -23,7 +23,7 @@ static int auth_etc_enlightenment_sysactions(char *a, char *u, char **g); static char *get_word(char *s, char *d); /* local subsystem globals */ -static Eina_Hash *actions; +static Eina_Hash *actions = NULL; /* externally accessible functions */ int @@ -79,7 +79,6 @@ main(int argc, char **argv) } eina_init(); - actions = eina_hash_string_superfast_new(NULL); if (!auth_action_ok(action, uid, gid, gl, gn, egid)) { @@ -95,8 +94,7 @@ main(int argc, char **argv) exit(20); } if (!test) return system(cmd); - - eina_hash_free(actions); + eina_shutdown(); return 0; @@ -220,11 +218,8 @@ auth_etc_enlightenment_sysactions(char *a, char *u, char **g) { while ((*pp) && (isspace(*pp))) pp++; s = eina_hash_find(actions, ugname); - if (s) - { - eina_hash_del(actions, ugname, s); - free(s); - } + if (s) eina_hash_del(actions, ugname, s); + if (!actions) actions = eina_hash_string_superfast_new(free); eina_hash_add(actions, ugname, strdup(pp)); continue; } diff --git a/src/bin/e_theme.c b/src/bin/e_theme.c index afc8c141f1..89286d85a5 100644 --- a/src/bin/e_theme.c +++ b/src/bin/e_theme.c @@ -10,19 +10,19 @@ struct _E_Theme_Result { const char *file; const char *cache; - Evas_Hash *quickfind; + Eina_Hash *quickfind; }; -static Evas_Bool _e_theme_mappings_free_cb(const Evas_Hash *hash, const void *key, void *data, void *fdata); -static Evas_Bool _e_theme_mappings_quickfind_free_cb(const Evas_Hash *hash, const void *key, void *data, void *fdata); +static Eina_Bool _e_theme_mappings_free_cb(const Eina_Hash *hash, const void *key, void *data, void *fdata); +static Eina_Bool _e_theme_mappings_quickfind_free_cb(const Eina_Hash *hash, const void *key, void *data, void *fdata); static void _e_theme_category_register(const char *category); static Eina_List *_e_theme_collection_item_register(Eina_List *list, const char *name); static Eina_List *_e_theme_collection_items_find(const char *base, const char *collname); /* local subsystem globals */ -static Evas_Hash *mappings = NULL; -static Evas_Hash *group_cache = NULL; +static Eina_Hash *mappings = NULL; +static Eina_Hash *group_cache = NULL; static Eina_List *categories = NULL; static Eina_List *transitions = NULL; @@ -38,8 +38,8 @@ e_theme_init(void) Eina_List *l = NULL; /* Register mime handler */ - theme_hdl = e_fm2_mime_handler_new(_("Set As Theme"), "enlightenment/themes", - e_theme_handler_set, NULL, + theme_hdl = e_fm2_mime_handler_new(_("Set As Theme"), "enlightenment/themes", + e_theme_handler_set, NULL, e_theme_handler_test, NULL); if (theme_hdl) e_fm2_mime_handler_glob_add(theme_hdl, "*.edj"); @@ -62,6 +62,9 @@ e_theme_init(void) transitions = _e_theme_collection_items_find("base/theme/transitions", "e/transitions"); borders = _e_theme_collection_items_find("base/theme/borders", "e/widgets/border"); shelfs = _e_theme_collection_items_find("base/theme/shelf", "e/shelf"); + if (!mappings) + mappings = eina_hash_string_superfast_new(NULL); + group_cache = eina_hash_string_superfast_new(NULL); return 1; } @@ -69,20 +72,20 @@ e_theme_init(void) EAPI int e_theme_shutdown(void) { - if (theme_hdl) + if (theme_hdl) { e_fm2_mime_handler_glob_del(theme_hdl, "*.edj"); e_fm2_mime_handler_free(theme_hdl); } if (mappings) { - evas_hash_foreach(mappings, _e_theme_mappings_free_cb, NULL); - evas_hash_free(mappings); + eina_hash_foreach(mappings, _e_theme_mappings_free_cb, NULL); + eina_hash_free(mappings); mappings = NULL; } if (group_cache) { - evas_hash_free(group_cache); + eina_hash_free(group_cache); group_cache = NULL; } while (categories) @@ -117,11 +120,11 @@ e_theme_edje_object_set(Evas_Object *o, const char *category, const char *group) /* find category -> edje mapping */ _e_theme_category_register(category); - res = evas_hash_find(mappings, category); + res = eina_hash_find(mappings, category); if (res) { const char *str; - + /* if found check cached path */ str = res->cache; if (!str) @@ -138,17 +141,17 @@ e_theme_edje_object_set(Evas_Object *o, const char *category, const char *group) { void *tres; int ok; - + snprintf(buf, sizeof(buf), "%s/::/%s", str, group); - tres = evas_hash_find(group_cache, buf); + tres = eina_hash_find(group_cache, buf); if (!tres) { ok = edje_object_file_set(o, str, group); /* save in the group cache hash */ if (ok) - group_cache = evas_hash_add(group_cache, buf, res); + eina_hash_add(group_cache, buf, res); else - group_cache = evas_hash_add(group_cache, buf, (void *)1); + eina_hash_add(group_cache, buf, (void *)1); } else if (tres == (void *)1) ok = 0; @@ -183,11 +186,11 @@ e_theme_edje_file_get(const char *category, const char *group) /* find category -> edje mapping */ _e_theme_category_register(category); - res = evas_hash_find(mappings, category); + res = eina_hash_find(mappings, category); if (res) { const char *str; - + /* if found check cached path */ str = res->cache; if (!str) @@ -205,32 +208,33 @@ e_theme_edje_file_get(const char *category, const char *group) void *tres; Eina_List *coll, *l; int ok; - + snprintf(buf, sizeof(buf), "%s/::/%s", str, group); - tres = evas_hash_find(group_cache, buf); + tres = eina_hash_find(group_cache, buf); if (!tres) { /* if the group exists - return */ if (!res->quickfind) { + res->quickfind = eina_hash_string_superfast_new(NULL); /* great a quick find hash of all group entires */ coll = edje_file_collection_list(str); for (l = coll; l; l = l->next) { q = eina_stringshare_add(l->data); - res->quickfind = evas_hash_direct_add(res->quickfind, q, q); + eina_hash_direct_add(res->quickfind, q, q); } if (coll) edje_file_collection_list_free(coll); } /* save in the group cache hash */ - if (evas_hash_find(res->quickfind, group)) + if (eina_hash_find(res->quickfind, group)) { - group_cache = evas_hash_add(group_cache, buf, res); + eina_hash_add(group_cache, buf, res); ok = 1; } else { - group_cache = evas_hash_add(group_cache, buf, (void *)1); + eina_hash_add(group_cache, buf, (void *)1); ok = 0; } } @@ -293,15 +297,15 @@ e_theme_file_set(const char *category, const char *file) if (group_cache) { - evas_hash_free(group_cache); + eina_hash_free(group_cache); group_cache = NULL; } _e_theme_category_register(category); - res = evas_hash_find(mappings, category); + res = eina_hash_find(mappings, category); if (res) { - mappings = evas_hash_del(mappings, category, res); - if (res->file) + eina_hash_del(mappings, category, res); + if (res->file) { e_filereg_deregister(res->file); eina_stringshare_del(res->file); @@ -312,7 +316,9 @@ e_theme_file_set(const char *category, const char *file) res = calloc(1, sizeof(E_Theme_Result)); res->file = eina_stringshare_add(file); e_filereg_register(res->file); - mappings = evas_hash_add(mappings, category, res); + if (!mappings) + mappings = eina_hash_string_superfast_new(NULL); + eina_hash_add(mappings, category, res); } EAPI int @@ -470,11 +476,11 @@ e_theme_shelf_list(void) return shelfs; } -EAPI void -e_theme_handler_set(Evas_Object *obj, const char *path, void *data) +EAPI void +e_theme_handler_set(Evas_Object *obj, const char *path, void *data) { E_Action *a; - + if (!path) return; e_theme_config_set("theme", path); e_config_save_queue(); @@ -482,35 +488,35 @@ e_theme_handler_set(Evas_Object *obj, const char *path, void *data) if ((a) && (a->func.go)) a->func.go(NULL, NULL); } -EAPI int -e_theme_handler_test(Evas_Object *obj, const char *path, void *data) +EAPI int +e_theme_handler_test(Evas_Object *obj, const char *path, void *data) { if (!path) return 0; - if (!edje_file_group_exists(path, "e/widgets/border/default/border")) + if (!edje_file_group_exists(path, "e/widgets/border/default/border")) return 0; return 1; } /* local subsystem functions */ static Evas_Bool -_e_theme_mappings_free_cb(const Evas_Hash *hash, const void *key, void *data, void *fdata) +_e_theme_mappings_free_cb(const Eina_Hash *hash, const void *key, void *data, void *fdata) { E_Theme_Result *res; - + res = data; if (res->file) eina_stringshare_del(res->file); if (res->cache) eina_stringshare_del(res->cache); if (res->quickfind) { - evas_hash_foreach(res->quickfind, _e_theme_mappings_quickfind_free_cb, NULL); - evas_hash_free(res->quickfind); + eina_hash_foreach(res->quickfind, _e_theme_mappings_quickfind_free_cb, NULL); + eina_hash_free(res->quickfind); } free(res); return 1; } static Evas_Bool -_e_theme_mappings_quickfind_free_cb(const Evas_Hash *hash, const void *key, void *data, void *fdata) +_e_theme_mappings_quickfind_free_cb(const Eina_Hash *hash, const void *key, void *data, void *fdata) { eina_stringshare_del(key); return 1; @@ -549,17 +555,17 @@ _e_theme_collection_items_find(const char *base, const char *collname) E_Theme_Result *res; char *category, *p, *p2; int collname_len; - + collname_len = strlen(collname); category = alloca(strlen(base) + 1); strcpy(category, base); do { - res = evas_hash_find(mappings, category); + res = eina_hash_find(mappings, category); if (res) { const char *str; - + /* if found check cached path */ str = res->cache; if (!str) diff --git a/src/bin/e_thumb.c b/src/bin/e_thumb.c index 88d45ea39d..8f33a3335d 100644 --- a/src/bin/e_thumb.c +++ b/src/bin/e_thumb.c @@ -33,7 +33,7 @@ static Eina_List *_thumbnailers = NULL; static Eina_List *_thumbnailers_exe = NULL; static Eina_List *_thumb_queue = NULL; static int _objid = 0; -static Evas_Hash *_thumbs = NULL; +static Eina_Hash *_thumbs = NULL; static int _pending = 0; static int _num_thumbnailers = 1; static Ecore_Event_Handler *_exe_del_handler = NULL; @@ -46,6 +46,7 @@ e_thumb_init(void) _exe_del_handler = ecore_event_handler_add(ECORE_EXE_EVENT_DEL, _e_thumb_cb_exe_event_del, NULL); + _thumbs = eina_hash_string_superfast_new(NULL); return 1; } @@ -64,7 +65,7 @@ e_thumb_shutdown(void) } _thumb_queue = eina_list_free(_thumb_queue); _objid = 0; - evas_hash_free(_thumbs); + eina_hash_free(_thumbs); _thumbs = NULL; _pending = 0; return 1; @@ -316,7 +317,7 @@ _e_thumb_hash_add(int objid, Evas_Object *obj) char buf[32]; snprintf(buf, sizeof(buf), "%i", objid); - _thumbs = evas_hash_add(_thumbs, buf, obj); + eina_hash_add(_thumbs, buf, obj); } static void @@ -325,7 +326,7 @@ _e_thumb_hash_del(int objid) char buf[32]; snprintf(buf, sizeof(buf), "%i", objid); - _thumbs = evas_hash_del(_thumbs, buf, NULL); + eina_hash_del(_thumbs, buf, NULL); if ((!_thumbs) && (!_thumbnailers)) _objid = 0; } @@ -335,7 +336,7 @@ _e_thumb_hash_find(int objid) char buf[32]; snprintf(buf, sizeof(buf), "%i", objid); - return evas_hash_find(_thumbs, buf); + return eina_hash_find(_thumbs, buf); } static void |