use EINA_LIST_FOREACH/EINA_LIST_FREE/eina_list_data_get

This commit is contained in:
Daniel Kolesa 2015-01-28 14:29:13 +00:00
parent 625032ba0b
commit 5521c33757
1 changed files with 9 additions and 14 deletions

View File

@ -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(&current_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)