From 5521c33757050217e1688e1596c223ec09bc2d37 Mon Sep 17 00:00:00 2001 From: Daniel Kolesa Date: Wed, 28 Jan 2015 14:29:13 +0000 Subject: [PATCH] use EINA_LIST_FOREACH/EINA_LIST_FREE/eina_list_data_get --- src/e_mod_main.c | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/src/e_mod_main.c b/src/e_mod_main.c index 824d9ab..86f2bad 100644 --- a/src/e_mod_main.c +++ b/src/e_mod_main.c @@ -255,13 +255,13 @@ void _tclock_config_updated(Config_Item *ci) { Eina_List *l; + Instance *inst; if (!tclock_config) return; - for (l = tclock_config->instances; l; l = l->next) + EINA_LIST_FOREACH(tclock_config->instances, l, inst) { - Instance *inst = l->data; if (inst->ci != ci) continue; @@ -285,6 +285,7 @@ static Eina_Bool _tclock_cb_check(void *data __UNUSED__) { Eina_List *l; + Instance *inst; time_t current_time; struct tm *local_time; char buf[1024]; @@ -292,10 +293,8 @@ _tclock_cb_check(void *data __UNUSED__) current_time = time(NULL); local_time = localtime(¤t_time); - for (l = tclock_config->instances; l; l = l->next) + EINA_LIST_FOREACH(tclock_config->instances, l, inst) { - Instance *inst = l->data; - if (!inst->ci->show_time) edje_object_signal_emit(inst->tclock, "time_hidden", ""); else @@ -345,7 +344,7 @@ _tclock_config_item_get(const char *id) if (tclock_config->items) { const char *p; - ci = eina_list_last(tclock_config->items)->data; + ci = eina_list_data_get(eina_list_last(tclock_config->items)); p = strrchr(ci->id, '.'); if (p) num = atoi(p + 1) + 1; } @@ -354,9 +353,8 @@ _tclock_config_item_get(const char *id) } else { - for (l = tclock_config->items; l; l = l->next) + EINA_LIST_FOREACH(tclock_config->items, l, ci) { - ci = l->data; if (!ci->id) continue; if (!strcmp(ci->id, id)) return ci; } @@ -436,6 +434,8 @@ e_modapi_init(E_Module *m) EAPI int e_modapi_shutdown(E_Module *m __UNUSED__) { + Config_Item *ci; + e_gadcon_provider_unregister(&_gc_class); if (tclock_config->cfd) @@ -447,13 +447,8 @@ e_modapi_shutdown(E_Module *m __UNUSED__) tclock_config->menu = NULL; } - while (tclock_config->items) + EINA_LIST_FREE(tclock_config->items, ci) { - Config_Item *ci; - - ci = tclock_config->items->data; - tclock_config->items = - eina_list_remove_list(tclock_config->items, tclock_config->items); if (ci->id) eina_stringshare_del(ci->id); if (ci->time_format)