From cb07217552777a1afe7c7bf84a4b3a54edacd16f Mon Sep 17 00:00:00 2001 From: cedric Date: Wed, 25 Feb 2009 11:03:47 +0000 Subject: [PATCH] * estickies, * etk, * PROTO/exalt, * E-MODULES-EXTRA/diskio, * E-MODULES-EXTRA/drawer, * E-MODULES-EXTRA/penguins, * E-MODULES-EXTRA/slideshow, * E-MODULES-EXTRA/mail, * E-MODULES-EXTRA/forecasts, * E-MODULES-EXTRA/iiirk, * E-MODULES-EXTRA/places, * e, * ewl, * ecore, * elitaire, * entrance, * e_dbus, * efreet: Here we go, move from Ecore_List to Eina_List. NOTE: This patch is huge, I did test it a lot, and I hope nothing is broken. But if you think something change after this commit, please contact me ASAP. git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/ecore@39200 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- src/lib/ecore/Ecore_Data.h | 10 ++-- src/lib/ecore/ecore_getopt.c | 9 ++-- src/lib/ecore/ecore_path.c | 53 ++++++++------------ src/lib/ecore/ecore_plugin.c | 33 ++++-------- src/lib/ecore_con/ecore_con.c | 28 ++++------- src/lib/ecore_con/ecore_con_info.c | 15 +++--- src/lib/ecore_con/ecore_con_url.c | 72 +++++++++------------------ src/lib/ecore_config/ecore_config_ipc_ecore.c | 1 + src/lib/ecore_evas/ecore_evas_fb.c | 21 ++++---- src/lib/ecore_fb/ecore_fb_li.c | 10 ++-- src/lib/ecore_file/Ecore_File.h | 4 +- src/lib/ecore_file/ecore_file.c | 14 ++---- src/lib/ecore_file/ecore_file_download.c | 29 +++-------- src/lib/ecore_file/ecore_file_monitor_poll.c | 27 ++++++---- src/lib/ecore_file/ecore_file_path.c | 62 +++++++++++------------ src/lib/ecore_imf/Ecore_IMF.h | 4 +- src/lib/ecore_imf/ecore_imf_context.c | 14 +++--- src/lib/ecore_imf/ecore_imf_module.c | 53 ++++++-------------- src/lib/ecore_imf/ecore_imf_private.h | 6 +-- src/lib/ecore_ipc/Ecore_Ipc.h | 2 +- src/lib/ecore_ipc/ecore_ipc.c | 44 ++++++++-------- src/lib/ecore_ipc/ecore_ipc_private.h | 6 +-- src/lib/ecore_x/xcb/ecore_xcb_reply.c | 36 ++++---------- 23 files changed, 221 insertions(+), 332 deletions(-) diff --git a/src/lib/ecore/Ecore_Data.h b/src/lib/ecore/Ecore_Data.h index 2a8331e..2397ccb 100644 --- a/src/lib/ecore/Ecore_Data.h +++ b/src/lib/ecore/Ecore_Data.h @@ -1,8 +1,6 @@ #ifndef _ECORE_DATA_H # define _ECORE_DATA_H -#include - #ifdef EAPI # undef EAPI #endif @@ -32,6 +30,8 @@ /* we need this for size_t */ #include +#include + /** * @file Ecore_Data.h * @brief Contains threading, list, hash, debugging and tree functions. @@ -300,7 +300,7 @@ extern "C" { struct _ecore_path_group { - Ecore_List *paths; + Eina_List *paths; }; /* @@ -331,7 +331,7 @@ extern "C" { /* * Get a list of all the available files in a path set */ - EAPI Ecore_List * ecore_path_group_available_get(Ecore_Path_Group *group); + EAPI Eina_List * ecore_path_group_available_get(Ecore_Path_Group *group); typedef struct _ecore_plugin Ecore_Plugin; @@ -355,7 +355,7 @@ extern "C" { */ EAPI void *ecore_plugin_symbol_get(Ecore_Plugin * plugin, const char *symbol_name); - EAPI Ecore_List *ecore_plugin_available_get(Ecore_Path_Group *group); + EAPI Eina_List *ecore_plugin_available_get(Ecore_Path_Group *group); typedef struct _ecore_heap Ecore_Sheap; diff --git a/src/lib/ecore/ecore_getopt.c b/src/lib/ecore/ecore_getopt.c index fc897c8..75c198c 100644 --- a/src/lib/ecore/ecore_getopt.c +++ b/src/lib/ecore/ecore_getopt.c @@ -1635,11 +1635,10 @@ ecore_getopt_parse(const Ecore_Getopt *parser, Ecore_Getopt_Value *values, int a Eina_List * ecore_getopt_list_free(Eina_List *list) { - while (list) - { - free(list->data); - list = eina_list_remove_list(list, list); - } + void *data; + + EINA_LIST_FREE(list, data) + free(data); return NULL; } diff --git a/src/lib/ecore/ecore_path.c b/src/lib/ecore/ecore_path.c index ea1431e..bb1f195 100644 --- a/src/lib/ecore/ecore_path.c +++ b/src/lib/ecore/ecore_path.c @@ -45,11 +45,12 @@ ecore_path_group_new(void) EAPI void ecore_path_group_del(Ecore_Path_Group *group) { - CHECK_PARAM_POINTER("group", group); + char *path; - if (group->paths) - ecore_list_destroy(group->paths); + CHECK_PARAM_POINTER("group", group); + EINA_LIST_FREE(group->paths, path) + free(path); free(group); } @@ -65,13 +66,7 @@ ecore_path_group_add(Ecore_Path_Group *group, const char *path) CHECK_PARAM_POINTER("group", group); CHECK_PARAM_POINTER("path", path); - if (!group->paths) - { - group->paths = ecore_list_new(); - ecore_list_free_cb_set(group->paths, free); - } - - ecore_list_append(group->paths, strdup(path)); + group->paths = eina_list_append(group->paths, strdup(path)); } /** @@ -94,16 +89,16 @@ ecore_path_group_remove(Ecore_Path_Group *group, const char *path) /* * Find the path in the list of available paths */ - ecore_list_first_goto(group->paths); - - while ((found = ecore_list_current(group->paths)) && strcmp(found, path)) - ecore_list_next(group->paths); + found = eina_list_search_unsorted(group->paths, strcmp, path); /* * If the path is found, remove and free it */ if (found) - ecore_list_remove_destroy(group->paths); + { + group->paths = eina_list_remove(group->paths, found); + free(found); + } } /** @@ -117,6 +112,7 @@ ecore_path_group_remove(Ecore_Path_Group *group, const char *path) EAPI char * ecore_path_group_find(Ecore_Path_Group *group, const char *name) { + Eina_List *l; int r; char *p; struct stat st; @@ -131,15 +127,13 @@ ecore_path_group_find(Ecore_Path_Group *group, const char *name) /* * Search the paths of the path group for the specified file name */ - ecore_list_first_goto(group->paths); - p = ecore_list_next(group->paths); - do + EINA_LIST_FOREACH(group->paths, l, p) { snprintf(path, PATH_MAX, "%s/%s", p, name); r = stat(path, &st); + if ((r >= 0) && S_ISREG(st.st_mode)) + break; } - while (((r < 0) || !S_ISREG(st.st_mode)) && - (p = ecore_list_next(group->paths))); if (p) p = strdup(path); @@ -154,20 +148,19 @@ ecore_path_group_find(Ecore_Path_Group *group, const char *name) * identified by @p group_id. @c NULL otherwise. * @ingroup Ecore_Path_Group */ -EAPI Ecore_List * +EAPI Eina_List * ecore_path_group_available_get(Ecore_Path_Group *group) { - Ecore_List *avail = NULL; + Eina_List *avail = NULL; + Eina_List *l; char *path; CHECK_PARAM_POINTER_RETURN("group", group, NULL); - if (!group->paths || ecore_list_empty_is(group->paths)) + if (!group->paths || !eina_list_count(group->paths)) return NULL; - ecore_list_first_goto(group->paths); - - while ((path = ecore_list_next(group->paths)) != NULL) + EINA_LIST_FOREACH(group->paths, l, path) { DIR *dir; struct stat st; @@ -203,13 +196,11 @@ ecore_path_group_available_get(Ecore_Path_Group *group) strncpy(n, d->d_name, l - 2); */ - if (!avail) - avail = ecore_list_new(); - -/* ecore_list_append(avail, strdup(n));*/ - ecore_list_append(avail, strdup(d->d_name)); +/* avail = eina_list_append(avail, strdup(n));*/ + avail = eina_list_append(avail, strdup(d->d_name)); } } return avail; } + diff --git a/src/lib/ecore/ecore_plugin.c b/src/lib/ecore/ecore_plugin.c index 0162a27..8b79dc1 100644 --- a/src/lib/ecore/ecore_plugin.c +++ b/src/lib/ecore/ecore_plugin.c @@ -28,7 +28,7 @@ #include "ecore_private.h" -static Ecore_List *loaded_plugins = NULL; +static Eina_List *loaded_plugins = NULL; static Eina_Bool _hash_keys(const Eina_Hash *hash, const char *key, @@ -106,10 +106,8 @@ ecore_plugin_load(Ecore_Path_Group *group, const char *plugin_name, const char * /* * Now add it to the list of the groups loaded plugins */ - if (!loaded_plugins) - loaded_plugins = ecore_list_new(); - ecore_list_append(loaded_plugins, plugin); + loaded_plugins = eina_list_append(loaded_plugins, plugin); FREE(path); @@ -129,14 +127,7 @@ ecore_plugin_unload(Ecore_Plugin *plugin) if (!plugin->handle) return; - if (ecore_list_goto(loaded_plugins, plugin)) - ecore_list_remove(loaded_plugins); - - if (ecore_list_empty_is(loaded_plugins)) - { - ecore_list_destroy(loaded_plugins); - loaded_plugins = NULL; - } + loaded_plugins = eina_list_remove(loaded_plugins, plugin); dlclose(plugin->handle); @@ -173,23 +164,23 @@ ecore_plugin_symbol_get(Ecore_Plugin *plugin, const char *symbol_name) * paths identified by @p group_id. @c NULL otherwise. * @ingroup Ecore_Plugin */ -EAPI Ecore_List * +EAPI Eina_List * ecore_plugin_available_get(Ecore_Path_Group *group) { - Ecore_List *avail = NULL; + Eina_List *avail = NULL; + Eina_List *l; Eina_Hash *plugins = NULL; Eina_Iterator *it = NULL; char *path; CHECK_PARAM_POINTER_RETURN("group", group, NULL); - if (!group->paths || ecore_list_empty_is(group->paths)) + if (!group->paths || !eina_list_count(group->paths)) return NULL; - ecore_list_first_goto(group->paths); plugins = eina_hash_string_superfast_new(NULL); - while ((path = ecore_list_next(group->paths)) != NULL) + EINA_LIST_FOREACH(group->paths, l, path) { DIR *dir; struct stat st; @@ -239,14 +230,10 @@ ecore_plugin_available_get(Ecore_Path_Group *group) closedir(dir); } - avail = ecore_list_new(); - ecore_list_free_cb_set(avail, free); - - it = eina_hash_iterator_data_new(plugins); if (it) { - eina_iterator_foreach(it, EINA_EACH(_hash_keys), avail); + eina_iterator_foreach(it, EINA_EACH(_hash_keys), &avail); eina_iterator_free(it); } @@ -259,6 +246,6 @@ ecore_plugin_available_get(Ecore_Path_Group *group) static Eina_Bool _hash_keys(const Eina_Hash *hash __UNUSED__, const char *key, void *list) { - ecore_list_append(list, strdup(key)); + *(Eina_List **)list = eina_list_append(*(Eina_List **)list, key); return EINA_TRUE; } diff --git a/src/lib/ecore_con/ecore_con.c b/src/lib/ecore_con/ecore_con.c index 5b83ed4..d9199ef 100644 --- a/src/lib/ecore_con/ecore_con.c +++ b/src/lib/ecore_con/ecore_con.c @@ -57,7 +57,7 @@ EAPI int ECORE_CON_EVENT_SERVER_DEL = 0; EAPI int ECORE_CON_EVENT_CLIENT_DATA = 0; EAPI int ECORE_CON_EVENT_SERVER_DATA = 0; -static Ecore_List *servers = NULL; +static Eina_List *servers = NULL; static int init_count = 0; #define LENGTH_OF_SOCKADDR_UN(s) (strlen((s)->sun_path) + (size_t)(((struct sockaddr_un *)NULL)->sun_path)) @@ -94,8 +94,6 @@ ecore_con_init(void) ecore_con_dns_init(); ecore_con_info_init(); - servers = ecore_list_new(); - return init_count; } @@ -110,10 +108,8 @@ ecore_con_shutdown(void) { if (--init_count != 0) return init_count; - while (!ecore_list_empty_is(servers)) - _ecore_con_server_free(ecore_list_first_remove(servers)); - ecore_list_destroy(servers); - servers = NULL; + while (servers) + _ecore_con_server_free(eina_list_data_get(servers)); ecore_con_info_shutdown(); ecore_con_dns_shutdown(); @@ -239,7 +235,7 @@ ecore_con_server_add(Ecore_Con_Type compl_type, const char *name, int port, socket_unix.sun_family = AF_UNIX; if (type == ECORE_CON_LOCAL_ABSTRACT) { -#ifdef HAVE_ABSTRACT_SOCKETS +#ifdef HAVE_ABSTRACT_SOCKET /* . is a placeholder */ snprintf(socket_unix.sun_path, sizeof(socket_unix.sun_path), ".%s", name); /* first char null indicates abstract namespace */ @@ -285,7 +281,7 @@ ecore_con_server_add(Ecore_Con_Type compl_type, const char *name, int port, if (!ecore_con_info_udp_listen(svr, _ecore_con_cb_udp_listen, svr)) goto error; } - ecore_list_append(servers, svr); + servers = eina_list_append(servers, svr); ECORE_MAGIC_SET(svr, ECORE_MAGIC_CON_SERVER); return svr; @@ -463,7 +459,7 @@ ecore_con_server_connect(Ecore_Con_Type compl_type, const char *name, int port, if (!ecore_con_info_udp_connect(svr, _ecore_con_cb_udp_connect, svr)) goto error; } - ecore_list_append(servers, svr); + servers = eina_list_append(servers, svr); ECORE_MAGIC_SET(svr, ECORE_MAGIC_CON_SERVER); return svr; @@ -494,6 +490,8 @@ ecore_con_server_del(Ecore_Con_Server *svr) ECORE_MAGIC_FAIL(svr, ECORE_MAGIC_CON_SERVER, "ecore_con_server_del"); return NULL; } + if (svr->delete_me) return NULL; + data = svr->data; svr->data = NULL; svr->delete_me = 1; @@ -508,7 +506,6 @@ ecore_con_server_del(Ecore_Con_Server *svr) else { _ecore_con_server_free(svr); - if (ecore_list_goto(servers, svr)) ecore_list_remove(servers); } return data; } @@ -886,12 +883,8 @@ _ecore_con_server_free(Ecore_Con_Server *svr) } } if (svr->write_buf) free(svr->write_buf); - while (svr->clients) - { - cl = eina_list_data_get(svr->clients); - svr->clients = eina_list_remove(svr->clients, cl); + EINA_LIST_FREE(svr->clients, cl) _ecore_con_client_free(cl); - } if ((svr->created) && (svr->path) && (svr->ppid == getpid())) unlink(svr->path); if (svr->fd >= 0) close(svr->fd); @@ -900,6 +893,7 @@ _ecore_con_server_free(Ecore_Con_Server *svr) if (svr->path) free(svr->path); if (svr->ip) free(svr->ip); if (svr->fd_handler) ecore_main_fd_handler_del(svr->fd_handler); + servers = eina_list_remove(servers, svr); free(svr); } @@ -1389,7 +1383,7 @@ static int _ecore_con_svr_udp_handler(void *data, Ecore_Fd_Handler *fd_handler) { Ecore_Con_Server *svr; - Ecore_Con_Client *cl; + Ecore_Con_Client *cl = NULL; svr = data; if (svr->dead) return 1; diff --git a/src/lib/ecore_con/ecore_con_info.c b/src/lib/ecore_con/ecore_con_info.c index de21a00..019dd99 100644 --- a/src/lib/ecore_con/ecore_con_info.c +++ b/src/lib/ecore_con/ecore_con_info.c @@ -198,9 +198,10 @@ ecore_con_info_get(Ecore_Con_Server *svr, char service[NI_MAXSERV]; char hbuf[NI_MAXHOST]; char sbuf[NI_MAXSERV]; - void *tosend; + void *tosend = NULL; int tosend_len; int canonname_len = 0; + int err; /* FIXME with EINA */ snprintf(service, NI_MAXSERV, "%i", svr->port); @@ -210,12 +211,13 @@ ecore_con_info_get(Ecore_Con_Server *svr, if (result->ai_canonname) canonname_len = strlen(result->ai_canonname) + 1; tosend_len = sizeof(Ecore_Con_Info) + result->ai_addrlen + canonname_len; - tosend = malloc(tosend_len); + + if ((tosend = malloc(tosend_len))); + goto on_error; + memset(tosend, 0, tosend_len); container = (Ecore_Con_Info *)tosend; container->size = tosend_len; - memset(container->ip, 0, sizeof(container->ip)); - memset(container->service, 0, sizeof(container->service)); memcpy(&container->info, result, sizeof(struct addrinfo)); memcpy(tosend + sizeof(Ecore_Con_Info), result->ai_addr, result->ai_addrlen); @@ -228,13 +230,14 @@ ecore_con_info_get(Ecore_Con_Server *svr, memcpy(container->ip, hbuf, sizeof(container->ip)); memcpy(container->service, sbuf, sizeof(container->service)); } - write(fd[1], tosend, tosend_len); + err = write(fd[1], tosend, tosend_len); free(tosend); } else - write(fd[1], "", 1); + err = write(fd[1], "", 1); +on_error: close(fd[1]); # ifdef __USE_ISOC99 _Exit(0); diff --git a/src/lib/ecore_con/ecore_con_url.c b/src/lib/ecore_con/ecore_con_url.c index 9461aa6..bbff690 100644 --- a/src/lib/ecore_con/ecore_con_url.c +++ b/src/lib/ecore_con/ecore_con_url.c @@ -80,7 +80,7 @@ static void _ecore_con_event_url_free(void *data __UNUSED__, void *ev); static int _ecore_con_url_process_completed_jobs(Ecore_Con_Url *url_con_to_match); static Ecore_Idler *_fd_idler_handler = NULL; -static Ecore_List *_url_con_list = NULL; +static Eina_List *_url_con_list = NULL; static CURLM *curlm = NULL; static fd_set _current_fd_set; static int init_count = 0; @@ -129,6 +129,8 @@ EAPI int ecore_con_url_init(void) { #ifdef HAVE_CURL + Ecore_Con_Url *url_con; + if (!ECORE_CON_EVENT_URL_DATA) { ECORE_CON_EVENT_URL_DATA = ecore_event_type_new(); @@ -136,27 +138,21 @@ ecore_con_url_init(void) ECORE_CON_EVENT_URL_PROGRESS = ecore_event_type_new(); } - if (!_url_con_list) - { - _url_con_list = ecore_list_new(); - if (!_url_con_list) return 0; - } - if (!curlm) { FD_ZERO(&_current_fd_set); if (curl_global_init(CURL_GLOBAL_NOTHING)) { - ecore_list_destroy(_url_con_list); - _url_con_list = NULL; + EINA_LIST_FREE(_url_con_list, url_con) + ecore_con_url_destroy(url_con); return 0; } curlm = curl_multi_init(); if (!curlm) { - ecore_list_destroy(_url_con_list); - _url_con_list = NULL; + EINA_LIST_FREE(_url_con_list, url_con) + ecore_con_url_destroy(url_con); return 0; } } @@ -176,24 +172,14 @@ EAPI int ecore_con_url_shutdown(void) { #ifdef HAVE_CURL + Ecore_Con_Url *url_con; if (!init_count) return 0; init_count--; - if (_url_con_list) - { - if (!ecore_list_empty_is(_url_con_list)) - { - Ecore_Con_Url *url_con; - while ((url_con = ecore_list_first(_url_con_list))) - { + EINA_LIST_FREE(_url_con_list, url_con) ecore_con_url_destroy(url_con); - } - } - ecore_list_destroy(_url_con_list); - _url_con_list = NULL; - } if (curlm) { @@ -286,8 +272,7 @@ ecore_con_url_destroy(Ecore_Con_Url *url_con) { if (url_con->active) { - if (ecore_list_find(_url_con_list, ecore_direct_compare, url_con) == url_con) - ecore_list_remove(_url_con_list); + _url_con_list = eina_list_remove(_url_con_list, url_con); url_con->active = 0; curl_multi_remove_handle(curlm, url_con->curl_easy); @@ -615,14 +600,14 @@ ecore_con_url_ftp_use_epsv_set(Ecore_Con_Url *url_con, int use_epsv) static int _ecore_con_url_suspend_fd_handler(void) { + Eina_List *l; Ecore_Con_Url *url_con; int deleted = 0; if (!_url_con_list) return 0; - ecore_list_first_goto(_url_con_list); - while ((url_con = ecore_list_current(_url_con_list))) + EINA_LIST_FOREACH(_url_con_list, l, url_con) { if (url_con->active && url_con->fd_handler) { @@ -630,7 +615,6 @@ _ecore_con_url_suspend_fd_handler(void) url_con->fd_handler = NULL; deleted++; } - ecore_list_next(_url_con_list); } return deleted; @@ -639,25 +623,23 @@ _ecore_con_url_suspend_fd_handler(void) static int _ecore_con_url_restart_fd_handler(void) { + Eina_List *l; Ecore_Con_Url *url_con; int activated = 0; if (!_url_con_list) return 0; - ecore_list_first_goto(_url_con_list); - while ((url_con = ecore_list_current(_url_con_list))) + EINA_LIST_FOREACH(_url_con_list, l, url_con) { - if (url_con->fd_handler == NULL - && url_con->fd != -1) + if (url_con->fd_handler == NULL && url_con->fd != -1) { - url_con->fd_handler = ecore_main_fd_handler_add(url_con->fd, + url_con->fd_handler == ecore_main_fd_handler_add(url_con->fd, url_con->flags, _ecore_con_url_fd_handler, NULL, NULL, NULL); activated++; } - ecore_list_next(_url_con_list); } return activated; @@ -781,7 +763,7 @@ _ecore_con_url_perform(Ecore_Con_Url *url_con) int still_running; int completed_immediately = 0; - ecore_list_append(_url_con_list, url_con); + _url_con_list = eina_list_append(_url_con_list, url_con); url_con->active = 1; curl_multi_add_handle(curlm, url_con->curl_easy); @@ -874,7 +856,9 @@ _ecore_con_url_fd_handler(void *data __UNUSED__, Ecore_Fd_Handler *fd_handler __ static int _ecore_con_url_process_completed_jobs(Ecore_Con_Url *url_con_to_match) { + Eina_List *l; Ecore_Con_Url *url_con; + Ecore_Con_Event_Url_Complete *e; CURLMsg *curlmsg; int n_remaining; int job_matched = 0; @@ -885,16 +869,13 @@ _ecore_con_url_process_completed_jobs(Ecore_Con_Url *url_con_to_match) if (curlmsg->msg != CURLMSG_DONE) continue; /* find the job which is done */ - ecore_list_first_goto(_url_con_list); - while ((url_con = ecore_list_current(_url_con_list))) + EINA_LIST_FOREACH(_url_con_list, l, url_con) { if (curlmsg->easy_handle == url_con->curl_easy) { - /* We have found the completed job in our job list */ - if (url_con_to_match && (url_con == url_con_to_match)) { + if (url_con_to_match && (url_con == url_con_to_match)) job_matched = 1; - } - if (url_con->fd != -1) + if(url_con->fd != -1) { FD_CLR(url_con->fd, &_current_fd_set); if (url_con->fd_handler) @@ -902,27 +883,22 @@ _ecore_con_url_process_completed_jobs(Ecore_Con_Url *url_con_to_match) url_con->fd = -1; url_con->fd_handler = NULL; } - ecore_list_remove(_url_con_list); + _url_con_list = eina_list_remove(_url_con_list, url_con); url_con->active = 0; - { - Ecore_Con_Event_Url_Complete *e; e = calloc(1, sizeof(Ecore_Con_Event_Url_Complete)); if (e) { e->url_con = url_con; - e->status = 0; curl_easy_getinfo(curlmsg->easy_handle, CURLINFO_RESPONSE_CODE, &e->status); - _url_complete_push_event(ECORE_CON_EVENT_URL_COMPLETE, e); } - } curl_multi_remove_handle(curlm, url_con->curl_easy); break; } - ecore_list_next(_url_con_list); } } + return job_matched; } diff --git a/src/lib/ecore_config/ecore_config_ipc_ecore.c b/src/lib/ecore_config/ecore_config_ipc_ecore.c index ad4ec35..bd2ec03 100644 --- a/src/lib/ecore_config/ecore_config_ipc_ecore.c +++ b/src/lib/ecore_config/ecore_config_ipc_ecore.c @@ -364,6 +364,7 @@ _ecore_config_ipc_ecore_exit(void **data) } ecore_ipc_shutdown(); + ecore_shutdown(); return ret; } diff --git a/src/lib/ecore_evas/ecore_evas_fb.c b/src/lib/ecore_evas/ecore_evas_fb.c index e97d864..6c187a8 100644 --- a/src/lib/ecore_evas/ecore_evas_fb.c +++ b/src/lib/ecore_evas/ecore_evas_fb.c @@ -23,7 +23,7 @@ static int _ecore_evas_init_count = 0; static int _ecore_evas_fps_debug = 0; static char *ecore_evas_default_display = "0"; -static Ecore_List *ecore_evas_input_devices = NULL; +static Eina_List *ecore_evas_input_devices = NULL; static Ecore_Evas *ecore_evases = NULL; static Ecore_Event_Handler *ecore_evas_event_handlers[6] = {NULL, NULL, NULL, NULL, NULL, NULL}; static Ecore_Idle_Enterer *ecore_evas_idle_enterer = NULL; @@ -76,6 +76,7 @@ static void _ecore_evas_fb_lose(void *data __UNUSED__) { Ecore_List2 *l; + Eina_List *ll; Ecore_Fb_Input_Device *dev; for (l = (Ecore_List2 *)ecore_evases; l; l = l->next) @@ -87,8 +88,7 @@ _ecore_evas_fb_lose(void *data __UNUSED__) } if (ecore_evas_input_devices) { - ecore_list_first_goto(ecore_evas_input_devices); - while ((dev = ecore_list_next(ecore_evas_input_devices))) + EINA_LIST_FOREACH(ecore_evas_input_devices, ll, dev) ecore_fb_input_device_listen(dev, 0); } } @@ -97,6 +97,7 @@ static void _ecore_evas_fb_gain(void *data __UNUSED__) { Ecore_List2 *l; + Eina_List *l; Ecore_Fb_Input_Device *dev; for (l = (Ecore_List2 *)ecore_evases; l; l = l->next) @@ -112,8 +113,7 @@ _ecore_evas_fb_gain(void *data __UNUSED__) } if (ecore_evas_input_devices) { - ecore_list_first_goto(ecore_evas_input_devices); - while ((dev = ecore_list_next(ecore_evas_input_devices))) + EINA_LIST_FOREACH(ecore_evas_input_devices, ll, dev) ecore_fb_input_device_listen(dev, 1); } } @@ -274,7 +274,6 @@ _ecore_evas_fb_init(int w, int h) input_dir = opendir("/dev/input/"); if (!input_dir) return _ecore_evas_init_count; - ecore_evas_input_devices = ecore_list_new(); while ((input_entry = readdir(input_dir))) { char device_path[256]; @@ -295,7 +294,7 @@ _ecore_evas_fb_init(int w, int h) { ecore_fb_input_device_axis_size_set(device, w, h); ecore_fb_input_device_listen(device,1); - ecore_list_append(ecore_evas_input_devices, device); + ecore_evas_input_devices = eina_list_append(ecore_evas_input_devices, device); if (!mouse_handled) { ecore_evas_event_handlers[2] = ecore_event_handler_add(ECORE_FB_EVENT_MOUSE_BUTTON_DOWN, _ecore_evas_event_mouse_button_down, NULL); @@ -309,7 +308,7 @@ _ecore_evas_fb_init(int w, int h) else if ((caps & ECORE_FB_INPUT_DEVICE_CAP_KEYS_OR_BUTTONS) && !(caps & ECORE_FB_INPUT_DEVICE_CAP_ABSOLUTE)) { ecore_fb_input_device_listen(device,1); - ecore_list_append(ecore_evas_input_devices, device); + ecore_evas_input_devices = eina_list_append(ecore_evas_input_devices, device); if (!keyboard_handled) { ecore_evas_event_handlers[0] = ecore_event_handler_add(ECORE_FB_EVENT_KEY_DOWN, _ecore_evas_event_key_down, NULL); @@ -480,6 +479,7 @@ _ecore_evas_object_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int layer, int h static void _ecore_evas_fullscreen_set(Ecore_Evas *ee, int on) { + Eina_List *l; int resized = 0; if (((ee->prop.fullscreen) && (on)) || @@ -520,9 +520,8 @@ _ecore_evas_fullscreen_set(Ecore_Evas *ee, int on) { Ecore_Fb_Input_Device *dev; - ecore_list_first_goto(ecore_evas_input_devices); - while ((dev = ecore_list_next(ecore_evas_input_devices))) - ecore_fb_input_device_axis_size_set(dev, ee->w, ee->h); + EINA_LIST_FOREACH(ecore_evas_input_devices, l, dev) + ecore_fb_input_device_axis_size_set(dev, ee->wn ee->h); } if (resized) { diff --git a/src/lib/ecore_fb/ecore_fb_li.c b/src/lib/ecore_fb/ecore_fb_li.c index bc0e11f..547aef4 100644 --- a/src/lib/ecore_fb/ecore_fb_li.c +++ b/src/lib/ecore_fb/ecore_fb_li.c @@ -11,7 +11,7 @@ #define CLICK_THRESHOLD_DEFAULT 0.25 -static Ecore_List *_ecore_fb_li_devices = NULL; +static Eina_List *_ecore_fb_li_devices = NULL; static const char *_ecore_fb_li_kbd_syms[128 * 6] = { @@ -374,9 +374,6 @@ ecore_fb_input_device_open(const char *dev) device = calloc(1, sizeof(Ecore_Fb_Input_Device)); if(!device) return NULL; - if(!_ecore_fb_li_devices) - _ecore_fb_li_devices = ecore_list_new(); - if((fd = open(dev, O_RDONLY, O_NONBLOCK)) < 0) { fprintf(stderr, "[ecore_fb_li:device_open] %s %s", dev, strerror(errno)); @@ -433,7 +430,7 @@ ecore_fb_input_device_open(const char *dev) break; } } - ecore_list_append(_ecore_fb_li_devices, device); + _ecore_fb_li_devices = eina_list_append(_ecore_fb_li_devices, device); return device; error_caps: @@ -450,8 +447,7 @@ ecore_fb_input_device_close(Ecore_Fb_Input_Device *dev) /* close the fd */ close(dev->fd); /* remove the element from the list */ - if(ecore_list_goto(_ecore_fb_li_devices, dev)) - ecore_list_remove(_ecore_fb_li_devices); + _ecore_fb_li_devices = eina_list_remove(_ecore_fb_li_devices, dev); free(dev); } diff --git a/src/lib/ecore_file/Ecore_File.h b/src/lib/ecore_file/Ecore_File.h index 03c2355..5bb8f0b 100644 --- a/src/lib/ecore_file/Ecore_File.h +++ b/src/lib/ecore_file/Ecore_File.h @@ -84,7 +84,7 @@ extern "C" { EAPI int ecore_file_can_write (const char *file); EAPI int ecore_file_can_exec (const char *file); EAPI char *ecore_file_readlink (const char *link); - EAPI Ecore_List *ecore_file_ls (const char *dir); + EAPI Eina_List *ecore_file_ls (const char *dir); EAPI char *ecore_file_app_exe_get (const char *app); EAPI char *ecore_file_escape_name (const char *filename); EAPI char *ecore_file_strip_ext (const char *file); @@ -100,7 +100,7 @@ extern "C" { EAPI int ecore_file_path_dir_exists(const char *in_dir); EAPI int ecore_file_app_installed(const char *exe); - EAPI Ecore_List *ecore_file_app_list(void); + EAPI Eina_List *ecore_file_app_list(void); EAPI int ecore_file_download(const char *url, const char *dst, void (*completion_cb)(void *data, diff --git a/src/lib/ecore_file/ecore_file.c b/src/lib/ecore_file/ecore_file.c index eb3f4f0..6efe5e0 100644 --- a/src/lib/ecore_file/ecore_file.c +++ b/src/lib/ecore_file/ecore_file.c @@ -509,36 +509,32 @@ ecore_file_readlink(const char *link) * For more information see the manual pages of strcoll and setlocale. * The list will not contain the directory entries for '.' and '..'. * @param dir The name of the directory to list - * @return Return an Ecore_List containing all the files in the directory; + * @return Return an Eina_List containing all the files in the directory; * on failure it returns NULL. */ -EAPI Ecore_List * +EAPI Eina_List * ecore_file_ls(const char *dir) { char *f; DIR *dirp; struct dirent *dp; - Ecore_List *list; + Eina_List *list = NULL; dirp = opendir(dir); if (!dirp) return NULL; - list = ecore_list_new(); - ecore_list_free_cb_set(list, free); - while ((dp = readdir(dirp))) { if ((strcmp(dp->d_name, ".")) && (strcmp(dp->d_name, ".."))) { f = strdup(dp->d_name); - ecore_list_append(list, f); + list = eina_list_append(list, f); } } closedir(dirp); - ecore_list_sort(list, ECORE_COMPARE_CB(strcoll), ECORE_SORT_MIN); + list = eina_list_sort(list, ECORE_SORT_MIN, ECORE_COMPARE_CB(strcoll)); - ecore_list_first_goto(list); return list; } diff --git a/src/lib/ecore_file/ecore_file_download.c b/src/lib/ecore_file/ecore_file_download.c index 4506f72..c855c71 100644 --- a/src/lib/ecore_file/ecore_file_download.c +++ b/src/lib/ecore_file/ecore_file_download.c @@ -45,7 +45,7 @@ static void _ecore_file_download_abort(Ecore_File_Download_Job *job); static int init = 0; static Ecore_Event_Handler *_url_complete_handler = NULL; static Ecore_Event_Handler *_url_progress_download = NULL; -static Ecore_List *_job_list; +static Eina_List *_job_list; EAPI int ecore_file_download_init(void) @@ -60,11 +60,6 @@ ecore_file_download_init(void) _url_progress_download = ecore_event_handler_add(ECORE_CON_EVENT_URL_PROGRESS, _ecore_file_download_url_progress_cb, NULL); #endif } - if (!_job_list) - { - _job_list = ecore_list_new(); - if (!_job_list) return 0; - } return 1; #else @@ -84,9 +79,7 @@ ecore_file_download_shutdown(void) ecore_event_handler_del(_url_progress_download); _url_complete_handler = NULL; _url_progress_download = NULL; - if (_job_list) - ecore_list_destroy(_job_list); - _job_list = NULL; + ecore_file_download_abort_all(); } return ecore_con_url_shutdown(); @@ -98,16 +91,10 @@ ecore_file_download_shutdown(void) EAPI void ecore_file_download_abort_all(void) { - if (!ecore_list_empty_is(_job_list)) - { Ecore_File_Download_Job *job; - while ((job = ecore_list_first_remove(_job_list))) - { + EINA_LIST_FREE(_job_list, job) _ecore_file_download_abort(job); - } - } - ecore_list_clear(_job_list); } /** @@ -212,10 +199,10 @@ _ecore_file_download_url_complete_cb(void *data, int type, void *event) Ecore_Con_Event_Url_Complete *ev = event; Ecore_File_Download_Job *job; - job = ecore_list_find(_job_list, _ecore_file_download_url_compare_job, ev->url_con); + job = eina_list_search_unsorted(_job_list, _ecore_file_download_url_compare_job, ev->url_con); if (!ECORE_MAGIC_CHECK(job, ECORE_MAGIC_FILE_DOWNLOAD_JOB)) return 1; - ecore_list_remove(_job_list); + _job_list = eina_list_remove(_job_list, job); if (job->completion_cb) job->completion_cb(ecore_con_url_data_get(job->url_con), job->dst, !ev->status); @@ -233,7 +220,7 @@ _ecore_file_download_url_progress_cb(void *data, int type, void *event) Ecore_Con_Event_Url_Progress *ev = event; Ecore_File_Download_Job *job; - job = ecore_list_find(_job_list, _ecore_file_download_url_compare_job, ev->url_con); + job = eina_list_search_unsorted(_job_list, _ecore_file_download_url_compare_job, ev->url_con); if (!ECORE_MAGIC_CHECK(job, ECORE_MAGIC_FILE_DOWNLOAD_JOB)) return 1; if (job->progress_cb) @@ -241,7 +228,7 @@ _ecore_file_download_url_progress_cb(void *data, int type, void *event) (long int) ev->down.total, (long int) ev->down.now, (long int) ev->up.total, (long int) ev->up.now) != 0) { - ecore_list_remove(_job_list); + _job_list = eina_list_remove(_job_list, job); _ecore_file_download_abort(job); } @@ -285,7 +272,7 @@ _ecore_file_download_curl(const char *url, const char *dst, job->completion_cb = completion_cb; job->progress_cb = progress_cb; - ecore_list_append(_job_list, job); + _job_list = eina_list_append(_job_list, job); ecore_con_url_send(job->url_con, NULL, 0, NULL); diff --git a/src/lib/ecore_file/ecore_file_monitor_poll.c b/src/lib/ecore_file/ecore_file_monitor_poll.c index 6573539..76bdc70 100644 --- a/src/lib/ecore_file/ecore_file_monitor_poll.c +++ b/src/lib/ecore_file/ecore_file_monitor_poll.c @@ -117,29 +117,28 @@ ecore_file_monitor_poll_add(const char *path, if (ecore_file_is_dir(em->path)) { /* Check for subdirs */ - Ecore_List *files; + Eina_List *files; char *file; files = ecore_file_ls(em->path); - if (files) - { - while ((file = ecore_list_next(files))) + EINA_LIST_FREE(files, file) { Ecore_File *f; char buf[PATH_MAX]; f = calloc(1, sizeof(Ecore_File)); if (!f) + { + free(file); continue; + } snprintf(buf, sizeof(buf), "%s/%s", em->path, file); - f->name = strdup(file); + f->name = file; f->mtime = ecore_file_mod_time(buf); f->is_dir = ecore_file_is_dir(buf); em->files = _ecore_list2_append(em->files, f); } - ecore_list_destroy(files); - } } } else @@ -307,7 +306,8 @@ _ecore_file_monitor_poll_check(Ecore_File_Monitor *em) /* Check for new files */ if (ECORE_FILE_MONITOR_POLL(em)->mtime < mtime) { - Ecore_List *files; + Eina_List *files; + Eina_List *l; char *file; /* Files have been added or removed */ @@ -315,7 +315,7 @@ _ecore_file_monitor_poll_check(Ecore_File_Monitor *em) if (files) { /* Are we a directory? We should check first, rather than rely on null here*/ - while ((file = ecore_list_next(files))) + EINA_LIST_FOREACH(files, l, file) { Ecore_File *f; char buf[PATH_MAX]; @@ -331,7 +331,7 @@ _ecore_file_monitor_poll_check(Ecore_File_Monitor *em) f->name = strdup(file); f->mtime = ecore_file_mod_time(buf); - f->is_dir = ecore_file_is_dir(buf); + f->is_dir = ecore_file_mod_time(buf); if (f->is_dir) event = ECORE_FILE_EVENT_CREATED_DIRECTORY; else @@ -339,7 +339,12 @@ _ecore_file_monitor_poll_check(Ecore_File_Monitor *em) em->func(em->data, em, event, buf); em->files = _ecore_list2_append(em->files, f); } - ecore_list_destroy(files); + while (files) + { + file = eina_list_data_get(files); + free(file); + files = eina_list_remove_list(files, files); + } } if (!ecore_file_is_dir(em->path)) diff --git a/src/lib/ecore_file/ecore_file_path.c b/src/lib/ecore_file/ecore_file_path.c index de2b4dc..dd1e95f 100644 --- a/src/lib/ecore_file/ecore_file_path.c +++ b/src/lib/ecore_file/ecore_file_path.c @@ -12,36 +12,35 @@ #include "ecore_file_private.h" static int init = 0; -static Ecore_List *__ecore_file_path_bin = NULL; +static Eina_List *__ecore_file_path_bin = NULL; -static Ecore_List *_ecore_file_path_from_env(const char *env); +static Eina_List *_ecore_file_path_from_env(const char *env); int ecore_file_path_init(void) { if (++init != 1) return init; __ecore_file_path_bin = _ecore_file_path_from_env("PATH"); - ecore_list_free_cb_set(__ecore_file_path_bin, free); return init; } int ecore_file_path_shutdown(void) { + char *dir; + if (--init != 0) return init; - ecore_list_destroy(__ecore_file_path_bin); - __ecore_file_path_bin = NULL; + EINA_LIST_FREE(__ecore_file_path_bin, dir) + free(dir); return init; } -Ecore_List * +Eina_List * _ecore_file_path_from_env(const char *env) { - Ecore_List *path; + Eina_List *path = NULL; char *env_path, *p, *last; - path = ecore_list_new(); - env_path = getenv(env); if (!env_path) return path; @@ -56,12 +55,12 @@ _ecore_file_path_from_env(const char *env) if (!*p) { if (!ecore_file_path_dir_exists(last)) - ecore_list_append(path, strdup(last)); + path = eina_list_append(path, strdup(last)); last = p + 1; } } if (p > last) - ecore_list_append(path, strdup(last)); + path = eina_list_append(path, strdup(last)); free(env_path); return path; @@ -75,14 +74,16 @@ _ecore_file_path_from_env(const char *env) EAPI int ecore_file_path_dir_exists(const char *in_dir) { + Eina_List *l; char *dir; if (!__ecore_file_path_bin) return 0; - ecore_list_first_goto(__ecore_file_path_bin); - while ((dir = ecore_list_next(__ecore_file_path_bin)) != NULL) + EINA_LIST_FOREACH(__ecore_file_path_bin, l, dir) { - if (!strcmp(dir, in_dir)) return 1; + if (strcmp(dir, in_dir)) + return 1; } + return 0; } @@ -96,50 +97,47 @@ ecore_file_path_dir_exists(const char *in_dir) EAPI int ecore_file_app_installed(const char *exe) { + Eina_List *l; char *dir; char buf[PATH_MAX]; if (!exe) return 0; if (ecore_file_can_exec(exe)) return 1; - ecore_list_first_goto(__ecore_file_path_bin); - while ((dir = ecore_list_next(__ecore_file_path_bin)) != NULL) + EINA_LIST_FOREACH(__ecore_file_path_bin, l, dir) { snprintf(buf, sizeof(buf), "%s/%s", dir, exe); - if (ecore_file_can_exec(buf)) return 1; + if (ecore_file_can_exec(buf)) + return 1; } + return 0; } /** * Get a list of all the applications installed on the system - * @return An Ecore_List containing all the executable files in the system + * @return An Eina_List containing all the executable files in the system */ -EAPI Ecore_List * +EAPI Eina_List * ecore_file_app_list(void) { - Ecore_List *list, *files; + Eina_List *list = NULL; + Eina_List *files; + Eina_List *l; char buf[PATH_MAX], *dir, *exe; - list = ecore_list_new(); - if (!list) return NULL; - ecore_list_free_cb_set(list, free); - ecore_list_first_goto(__ecore_file_path_bin); - while ((dir = ecore_list_next(__ecore_file_path_bin)) != NULL) + EINA_LIST_FOREACH(__ecore_file_path_bin, l, dir) { files = ecore_file_ls(dir); - if (files) - { - ecore_list_first_goto(files); - while ((exe = ecore_list_next(files)) != NULL) + EINA_LIST_FREE(files, exe) { snprintf(buf, sizeof(buf), "%s/%s", dir, exe); if ((ecore_file_can_exec(buf)) && (!ecore_file_is_dir(buf))) - ecore_list_append(list, strdup(buf)); - } - ecore_list_destroy(files); + list = eina_list_append(list, strdup(buf)); + free(exe); } } + return list; } diff --git a/src/lib/ecore_imf/Ecore_IMF.h b/src/lib/ecore_imf/Ecore_IMF.h index 71f890f..1ae8708 100644 --- a/src/lib/ecore_imf/Ecore_IMF.h +++ b/src/lib/ecore_imf/Ecore_IMF.h @@ -294,8 +294,8 @@ extern "C" { EAPI int ecore_imf_init(void); EAPI int ecore_imf_shutdown(void); - EAPI Ecore_List *ecore_imf_context_available_ids_get(void); - EAPI Ecore_List *ecore_imf_context_available_ids_by_canvas_type_get(const char *canvas_type); + EAPI Eina_List *ecore_imf_context_available_ids_get(void); + EAPI Eina_List *ecore_imf_context_available_ids_by_canvas_type_get(const char *canvas_type); EAPI const char *ecore_imf_context_default_id_get(void); EAPI const char *ecore_imf_context_default_id_by_canvas_type_get(const char *canvas_type); EAPI const Ecore_IMF_Context_Info *ecore_imf_context_info_by_id_get(const char *id); diff --git a/src/lib/ecore_imf/ecore_imf_context.c b/src/lib/ecore_imf/ecore_imf_context.c index 827b794..d8b7ce1 100644 --- a/src/lib/ecore_imf/ecore_imf_context.c +++ b/src/lib/ecore_imf/ecore_imf_context.c @@ -24,20 +24,20 @@ /** * Get the list of the available Input Method Context ids. * - * Note that the caller is responsible for freeing the Ecore_List + * Note that the caller is responsible for freeing the Eina_List * when finished with it. There is no need to finish the list strings. * - * @return Return an Ecore_List of strings; + * @return Return an EIna_List of strings; * on failure it returns NULL. * @ingroup Ecore_IMF_Context_Group */ -EAPI Ecore_List * +EAPI Eina_List * ecore_imf_context_available_ids_get(void) { return ecore_imf_module_context_ids_get(); } -EAPI Ecore_List * +EAPI Eina_List * ecore_imf_context_available_ids_by_canvas_type_get(const char *canvas_type) { return ecore_imf_module_context_ids_by_canvas_type_get(canvas_type); @@ -85,7 +85,7 @@ EAPI const char * ecore_imf_context_default_id_by_canvas_type_get(const char *canvas_type) { const char *id; - Ecore_List *modules; + Eina_List *modules; Ecore_IMF_Module *module; char *locale; char *tmp; @@ -113,8 +113,7 @@ ecore_imf_context_default_id_by_canvas_type_get(const char *canvas_type) id = NULL; - ecore_list_first_goto(modules); - while ((module = ecore_list_next(modules))) + EINA_LIST_FREE(modules, module) { if (canvas_type && strcmp(module->info->canvas_type, canvas_type) == 0) @@ -135,7 +134,6 @@ ecore_imf_context_default_id_by_canvas_type_get(const char *canvas_type) p = q ? q + 1 : NULL; } } - ecore_list_destroy(modules); free(locale); return id; diff --git a/src/lib/ecore_imf/ecore_imf_module.c b/src/lib/ecore_imf/ecore_imf_module.c index 78de2dc..07fd849 100644 --- a/src/lib/ecore_imf/ecore_imf_module.c +++ b/src/lib/ecore_imf/ecore_imf_module.c @@ -66,33 +66,25 @@ ecore_imf_module_shutdown(void) static Eina_Bool _hash_module_available_get(const Eina_Hash *hash, int *data, void *list) { - ecore_list_append(list, data); + *(Eina_List**)list = eina_list_append(*(Eina_List**)list, data); return EINA_TRUE; } -Ecore_List * +Eina_List * ecore_imf_module_available_get(void) { - Ecore_List *values; + Eina_List *values = NULL; Eina_Iterator *it = NULL; if (!modules) return NULL; - values = ecore_list_new(); - if (!values) return NULL; - it = eina_hash_iterator_data_new(modules); if (!it) - { - ecore_list_destroy(values); return NULL; - } - eina_iterator_foreach(it, EINA_EACH(_hash_module_available_get), values); + eina_iterator_foreach(it, EINA_EACH(_hash_module_available_get), &values); eina_iterator_free(it); - ecore_list_first_goto(values); - return values; } @@ -128,29 +120,23 @@ ecore_imf_module_context_create(const char *ctx_id) static Eina_Bool _hash_ids_get(const Eina_Hash *hash, const char *key, void *list) { - ecore_list_append(list, key); + *(Eina_List**)list = eina_list_append(*(Eina_List**)list, key); return EINA_TRUE; } -Ecore_List * +Eina_List * ecore_imf_module_context_ids_get(void) { - Ecore_List *l = NULL; + Eina_List *l = NULL; Eina_Iterator *it = NULL; if (!modules) return NULL; - l = ecore_list_new(); - if (!l) return NULL; - it = eina_hash_iterator_key_new(modules); if (!it) - { - ecore_list_destroy(l); return NULL; - } - eina_iterator_foreach(it, EINA_EACH(_hash_ids_get), l); + eina_iterator_foreach(it, EINA_EACH(_hash_ids_get), &l); eina_iterator_free(it); return l; @@ -163,16 +149,16 @@ _hash_ids_by_canvas_type_get(const Eina_Hash *hash, void *data, void *fdata) Ecore_IMF_Selector *selector = fdata; if (!strcmp(module->info->canvas_type, selector->toselect)) - ecore_list_append(selector->selected, (void *)module->info->id); + selector->selected = eina_list_append(selector->selected, (void *)module->info->id); return EINA_TRUE; } -Ecore_List * +Eina_List * ecore_imf_module_context_ids_by_canvas_type_get(const char *canvas_type) { Ecore_IMF_Selector selector; - Ecore_List *values; + Eina_List *values = NULL; Eina_Iterator *it = NULL; if (!modules) return NULL; @@ -180,30 +166,22 @@ ecore_imf_module_context_ids_by_canvas_type_get(const char *canvas_type) if (!canvas_type) return ecore_imf_module_context_ids_get(); - values = ecore_list_new(); - if (!values) return NULL; - it = eina_hash_iterator_data_new(modules); if (!it) - { - ecore_list_destroy(values); return NULL; - } selector.toselect = canvas_type; selector.selected = values; eina_iterator_foreach(it, EINA_EACH(_hash_ids_by_canvas_type_get), &selector); eina_iterator_free(it); - ecore_list_first_goto(values); - return values; } static void _ecore_imf_module_load_all(void) { - Ecore_List *avail; + Eina_List *avail; char *filename; Ecore_Plugin *plugin; const Ecore_IMF_Context_Info *info = NULL; @@ -213,8 +191,7 @@ _ecore_imf_module_load_all(void) avail = ecore_plugin_available_get(ecore_imf_modules_path); if (!avail) return; - ecore_list_first_goto(avail); - while ((filename = ecore_list_next(avail))) + EINA_LIST_FREE(avail, filename) { plugin = ecore_plugin_load(ecore_imf_modules_path, filename, NULL); if (!plugin) @@ -255,8 +232,6 @@ _ecore_imf_module_load_all(void) _ecore_imf_module_append(plugin, info, imf_module_create); } - - ecore_list_destroy(avail); } static void @@ -267,7 +242,7 @@ _ecore_imf_module_append(Ecore_Plugin *plugin, Ecore_IMF_Module *module; if (!modules) - modules = eina_hash_string_superfast_new(_ecore_imf_module_free); + modules = eina_hash_string_superfast_new(EINA_FREE_CB(_ecore_imf_module_free)); module = malloc(sizeof(Ecore_IMF_Module)); module->plugin = plugin; diff --git a/src/lib/ecore_imf/ecore_imf_private.h b/src/lib/ecore_imf/ecore_imf_private.h index dd951e2..e6812e7 100644 --- a/src/lib/ecore_imf/ecore_imf_private.h +++ b/src/lib/ecore_imf/ecore_imf_private.h @@ -29,10 +29,10 @@ struct _Ecore_IMF_Module void ecore_imf_module_init(void); void ecore_imf_module_shutdown(void); -Ecore_List *ecore_imf_module_available_get(void); +Eina_List *ecore_imf_module_available_get(void); Ecore_IMF_Module *ecore_imf_module_get(const char *ctx_id); Ecore_IMF_Context *ecore_imf_module_context_create(const char *ctx_id); -Ecore_List *ecore_imf_module_context_ids_get(void); -Ecore_List *ecore_imf_module_context_ids_by_canvas_type_get(const char *canvas_type); +Eina_List *ecore_imf_module_context_ids_get(void); +Eina_List *ecore_imf_module_context_ids_by_canvas_type_get(const char *canvas_type); #endif diff --git a/src/lib/ecore_ipc/Ecore_Ipc.h b/src/lib/ecore_ipc/Ecore_Ipc.h index 8e07366..9c26a74 100644 --- a/src/lib/ecore_ipc/Ecore_Ipc.h +++ b/src/lib/ecore_ipc/Ecore_Ipc.h @@ -297,7 +297,7 @@ EAPI unsigned long long _ecore_ipc_swap_64(unsigned long long v); EAPI void *ecore_ipc_server_del(Ecore_Ipc_Server *svr); EAPI void *ecore_ipc_server_data_get(Ecore_Ipc_Server *svr); EAPI int ecore_ipc_server_connected_get(Ecore_Ipc_Server *svr); - EAPI Ecore_List *ecore_ipc_server_clients_get(Ecore_Ipc_Server *svr); + EAPI Eina_List *ecore_ipc_server_clients_get(Ecore_Ipc_Server *svr); /* FIXME: this needs to become an ipc message */ EAPI int ecore_ipc_server_send(Ecore_Ipc_Server *svr, int major, int minor, int ref, int ref_to, int response, const void *data, int size); EAPI void ecore_ipc_server_client_limit_set(Ecore_Ipc_Server *svr, int client_limit, char reject_excess_clients); diff --git a/src/lib/ecore_ipc/ecore_ipc.c b/src/lib/ecore_ipc/ecore_ipc.c index 6bfc04b..e69866a 100644 --- a/src/lib/ecore_ipc/ecore_ipc.c +++ b/src/lib/ecore_ipc/ecore_ipc.c @@ -241,7 +241,7 @@ EAPI int ECORE_IPC_EVENT_CLIENT_DATA = 0; EAPI int ECORE_IPC_EVENT_SERVER_DATA = 0; static int init_count = 0; -static Ecore_Ipc_Server *servers = NULL; +static Eina_List *servers = NULL; static Ecore_Event_Handler *handler[6]; /** @@ -300,7 +300,7 @@ ecore_ipc_shutdown(void) if (--init_count != 0) return init_count; - while (servers) ecore_ipc_server_del(servers); + while (servers) ecore_ipc_server_del(eina_list_data_get(servers)); for (i = 0; i < 6; i++) ecore_event_handler_del(handler[i]); @@ -364,9 +364,7 @@ ecore_ipc_server_add(Ecore_Ipc_Type compl_type, const char *name, int port, cons } svr->max_buf_size = 32 * 1024; svr->data = (void *)data; - svr->client_list = ecore_list_new(); - ecore_list_init(svr->client_list); - servers = _ecore_list2_append(servers, svr); + servers = eina_list_append(servers, svr); ECORE_MAGIC_SET(svr, ECORE_MAGIC_IPC_SERVER); return svr; } @@ -422,7 +420,7 @@ ecore_ipc_server_connect(Ecore_Ipc_Type compl_type, char *name, int port, const } svr->max_buf_size = -1; svr->data = (void *)data; - servers = _ecore_list2_append(servers, svr); + servers = eina_list_append(servers, svr); ECORE_MAGIC_SET(svr, ECORE_MAGIC_IPC_SERVER); return svr; } @@ -444,17 +442,21 @@ ecore_ipc_server_del(Ecore_Ipc_Server *svr) "ecore_ipc_server_del"); return NULL; } + if (svr->delete_me) return NULL; + data = svr->data; svr->data = NULL; svr->delete_me = 1; if (svr->event_count == 0) { - while (svr->clients) - ecore_ipc_client_del((Ecore_Ipc_Client *)svr->clients); + Ecore_Ipc_Client *cl; + + EINA_LIST_FREE(svr->clients, cl) + ecore_ipc_client_del(cl); ecore_con_server_del(svr->server); - servers = _ecore_list2_remove(servers, svr); + servers = eina_list_remove(servers, svr); + if (svr->buf) free(svr->buf); - if (svr->client_list) ecore_list_destroy(svr->client_list); ECORE_MAGIC_SET(svr, ECORE_MAGIC_NONE); free(svr); } @@ -500,10 +502,10 @@ ecore_ipc_server_connected_get(Ecore_Ipc_Server *svr) /** * Retrieves the list of clients for this server. * @param svr The given IPC server. - * @return An Ecore_List with the clients. + * @return An Eina_List with the clients. * @ingroup Ecore_IPC_Server_Group */ -EAPI Ecore_List * +EAPI Eina_List * ecore_ipc_server_clients_get(Ecore_Ipc_Server *svr) { if (!ECORE_MAGIC_CHECK(svr, ECORE_MAGIC_IPC_SERVER)) @@ -1000,7 +1002,7 @@ _ecore_ipc_event_client_add(void *data __UNUSED__, int ev_type __UNUSED__, void Ecore_Con_Event_Client_Add *e; e = ev; - if (!_ecore_list2_find(servers, ecore_con_server_data_get(ecore_con_client_server_get(e->client)))) return 1; + if (!eina_list_data_find(servers, ecore_con_server_data_get(ecore_con_client_server_get(e->client)))) return 1; /* handling code here */ { Ecore_Ipc_Client *cl; @@ -1014,7 +1016,7 @@ _ecore_ipc_event_client_add(void *data __UNUSED__, int ev_type __UNUSED__, void cl->max_buf_size = 32 * 1024; ecore_con_client_data_set(cl->client, (void *)cl); svr->clients = _ecore_list2_append(svr->clients, cl); - ecore_list_append(svr->client_list, cl); + svr->client_list = eina_list_append(svr->client_list, cl); if (!cl->delete_me) { Ecore_Ipc_Event_Client_Add *e2; @@ -1038,7 +1040,7 @@ _ecore_ipc_event_client_del(void *data __UNUSED__, int ev_type __UNUSED__, void Ecore_Con_Event_Client_Del *e; e = ev; - if (!_ecore_list2_find(servers, ecore_con_server_data_get(ecore_con_client_server_get(e->client)))) return 1; + if (!eina_list_data_find(servers, ecore_con_server_data_get(ecore_con_client_server_get(e->client)))) return 1; /* handling code here */ { Ecore_Ipc_Client *cl; @@ -1049,9 +1051,7 @@ _ecore_ipc_event_client_del(void *data __UNUSED__, int ev_type __UNUSED__, void Ecore_Ipc_Server *svr; svr = ecore_con_server_data_get(ecore_con_client_server_get(e->client)); - ecore_list_goto(svr->client_list, cl); - ecore_list_remove(svr->client_list); - ecore_list_first_goto(svr->client_list); + svr->client_list = eina_list_remove(svr->client_list, cl); if (!cl->delete_me) { e2 = calloc(1, sizeof(Ecore_Ipc_Event_Client_Del)); @@ -1074,7 +1074,7 @@ _ecore_ipc_event_server_add(void *data __UNUSED__, int ev_type __UNUSED__, void Ecore_Con_Event_Server_Add *e; e = ev; - if (!_ecore_list2_find(servers, ecore_con_server_data_get(e->server))) return 1; + if (!eina_list_data_find(servers, ecore_con_server_data_get(e->server))) return 1; /* handling code here */ { Ecore_Ipc_Server *svr; @@ -1103,7 +1103,7 @@ _ecore_ipc_event_server_del(void *data __UNUSED__, int ev_type __UNUSED__, void Ecore_Con_Event_Server_Del *e; e = ev; - if (!_ecore_list2_find(servers, ecore_con_server_data_get(e->server))) return 1; + if (!eina_list_data_find(servers, ecore_con_server_data_get(e->server))) return 1; /* handling code here */ { Ecore_Ipc_Server *svr; @@ -1173,7 +1173,7 @@ _ecore_ipc_event_client_data(void *data __UNUSED__, int ev_type __UNUSED__, void Ecore_Con_Event_Client_Data *e; e = ev; - if (!_ecore_list2_find(servers, ecore_con_server_data_get(ecore_con_client_server_get(e->client)))) return 1; + if (!eina_list_data_find(servers, ecore_con_server_data_get(ecore_con_client_server_get(e->client)))) return 1; /* handling code here */ { Ecore_Ipc_Client *cl; @@ -1365,7 +1365,7 @@ _ecore_ipc_event_server_data(void *data __UNUSED__, int ev_type __UNUSED__, void Ecore_Con_Event_Server_Data *e; e = ev; - if (!_ecore_list2_find(servers, ecore_con_server_data_get(e->server))) return 1; + if (!eina_list_data_find(servers, ecore_con_server_data_get(e->server))) return 1; /* handling code here */ { Ecore_Ipc_Server *svr; diff --git a/src/lib/ecore_ipc/ecore_ipc_private.h b/src/lib/ecore_ipc/ecore_ipc_private.h index f8813a8..9595975 100644 --- a/src/lib/ecore_ipc/ecore_ipc_private.h +++ b/src/lib/ecore_ipc/ecore_ipc_private.h @@ -39,7 +39,6 @@ __attribute__ ((packed)); struct _Ecore_Ipc_Client { - Ecore_List __list_data; ECORE_MAGIC; Ecore_Con_Client *client; void *data; @@ -57,11 +56,10 @@ struct _Ecore_Ipc_Client struct _Ecore_Ipc_Server { - Ecore_List __list_data; ECORE_MAGIC; Ecore_Con_Server *server; - Ecore_Ipc_Client *clients; - Ecore_List *client_list; + Eina_List *clients; + Eina_List *client_list; void *data; unsigned char *buf; int buf_size; diff --git a/src/lib/ecore_x/xcb/ecore_xcb_reply.c b/src/lib/ecore_x/xcb/ecore_xcb_reply.c index f27f3b0..13402b6 100644 --- a/src/lib/ecore_x/xcb/ecore_xcb_reply.c +++ b/src/lib/ecore_x/xcb/ecore_xcb_reply.c @@ -19,7 +19,7 @@ * but its code is commented. */ -static Ecore_List *_ecore_xcb_cookies = NULL; +static Eina_List *_ecore_xcb_cookies = NULL; static void *_ecore_xcb_reply = NULL; typedef struct _Ecore_Xcb_Data Ecore_Xcb_Data; @@ -33,35 +33,22 @@ struct _Ecore_Xcb_Data int _ecore_x_reply_init () { - _ecore_xcb_cookies = ecore_list_new(); - if (!_ecore_xcb_cookies) - return 0; - - if (!ecore_list_init(_ecore_xcb_cookies)) - { - ecore_list_destroy(_ecore_xcb_cookies); - return 0; - } - - if (!ecore_list_free_cb_set(_ecore_xcb_cookies, ECORE_FREE_CB(free))) - { - ecore_list_destroy(_ecore_xcb_cookies); - return 0; - } - return 1; } void _ecore_x_reply_shutdown () { + Ecore_Xcb_Data *data; + if (_ecore_xcb_reply) free(_ecore_xcb_reply); if (!_ecore_xcb_cookies) return; - ecore_list_destroy(_ecore_xcb_cookies); + EINA_LIST_FREE(_ecore_xcb_cookies, data) + free(data); } void @@ -78,7 +65,8 @@ _ecore_xcb_cookie_cache (unsigned int cookie) data->cookie = cookie; - if (!ecore_list_append(_ecore_xcb_cookies, data)) + _ecore_xcb_cookies = eina_list_append(_ecore_xcb_cookies, data); + if (!eina_list_data_find(_ecore_xcb_cookies, data)) { free(data); return; @@ -94,16 +82,14 @@ _ecore_xcb_cookie_get (void) if (!_ecore_xcb_cookies) return 0; - data = ecore_list_first_remove(_ecore_xcb_cookies); - if (data) - { + data = eina_list_data_get(_ecore_xcb_cookies); + if (!data) return 0; + + _ecore_xcb_cookies = eina_list_remove_list(_ecore_xcb_cookies, _ecore_xcb_cookies); cookie = data->cookie; free(data); return cookie; - } - - return 0; } void -- 2.7.4