* 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.


SVN revision: 39200
This commit is contained in:
Cedric BAIL 2009-02-25 11:03:47 +00:00
parent e31b5e961e
commit 6978e98dc6
45 changed files with 1113 additions and 1284 deletions

View File

@ -1,8 +1,6 @@
#ifndef _ECORE_DATA_H
# define _ECORE_DATA_H
#include <Eina.h>
#ifdef EAPI
# undef EAPI
#endif
@ -32,6 +30,8 @@
/* we need this for size_t */
#include <stddef.h>
#include <Eina.h>
/**
* @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;

View File

@ -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;
}

View File

@ -45,11 +45,12 @@ ecore_path_group_new(void)
EAPI void
ecore_path_group_del(Ecore_Path_Group *group)
{
char *path;
CHECK_PARAM_POINTER("group", group);
if (group->paths)
ecore_list_destroy(group->paths);
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;
}

View File

@ -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;
}

View File

@ -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;

View File

@ -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);

View File

@ -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;
}

View File

@ -364,6 +364,7 @@ _ecore_config_ipc_ecore_exit(void **data)
}
ecore_ipc_shutdown();
ecore_shutdown();
return ret;
}

View File

@ -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)
{

View File

@ -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);
}

View File

@ -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,

View File

@ -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;
}

View File

@ -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);

View File

@ -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))

View File

@ -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;
}

View File

@ -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);

View File

@ -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;

View File

@ -66,33 +66,25 @@ ecore_imf_module_shutdown(void)
static Eina_Bool