From d89e43afd54b8419476d83ab2ab422d7e0bb47af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Wed, 23 May 2012 14:22:02 +0200 Subject: Eiotas_Particle uses Eina_Inlist --- src/include/eiotas_particle.h | 3 ++- src/include/eiotas_spin.h | 6 +++--- src/lib/eiotas_spin.c | 13 +++++-------- 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/src/include/eiotas_particle.h b/src/include/eiotas_particle.h index a34fbe4..e376e8f 100644 --- a/src/include/eiotas_particle.h +++ b/src/include/eiotas_particle.h @@ -20,12 +20,13 @@ #define __EIOTAS_PARTICLE_H__ #include +#include #include typedef struct _Eiotas_Particle Eiotas_Particle; struct _Eiotas_Particle { - Eina_Stringshare *src; /* TODO */ + EINA_INLIST; }; void eiotas_particle_free(Eiotas_Particle *particle); diff --git a/src/include/eiotas_spin.h b/src/include/eiotas_spin.h index 009b7c7..5f7470b 100644 --- a/src/include/eiotas_spin.h +++ b/src/include/eiotas_spin.h @@ -23,7 +23,7 @@ #include "eiotas_iota.h" #include "eiotas_particle.h" -#include +#include #include typedef struct _Eiotas_Spin Eiotas_Spin; @@ -31,8 +31,8 @@ typedef struct _Eiotas_Spin Eiotas_Spin; struct _Eiotas_Spin { Eiotas_Room room; /* higher level Room */ Eina_Array *free_particles; /* lifo of free to reuse Particles TODO support different particle types, use an Eina_Hash */ - Eina_List *app_fifo; /* fifo of application priority particles */ - Eina_List *sys_fifo; /* fifo of system priority particles */ + Eina_Inlist *app_fifo; /* fifo of application priority particles */ + Eina_Inlist *sys_fifo; /* fifo of system priority particles */ }; EAPI void eiotas_spin_free(Eiotas_Spin *spin); diff --git a/src/lib/eiotas_spin.c b/src/lib/eiotas_spin.c index a99c9d1..195b772 100644 --- a/src/lib/eiotas_spin.c +++ b/src/lib/eiotas_spin.c @@ -41,8 +41,7 @@ EAPI void eiotas_spin_free(Eiotas_Spin *spin) unsigned int i; Eiotas_Particle *particle; Eina_Array_Iterator iterator; - Eina_List *list; - Eina_List *l; + Eina_Inlist *list; DBG("Spin free 0x%X",PRINTPTR(spin)); @@ -50,10 +49,8 @@ EAPI void eiotas_spin_free(Eiotas_Spin *spin) eina_hash_free(spin->room.children); EINA_ARRAY_ITER_NEXT(spin->free_particles, i, particle, iterator) eiotas_particle_free(particle); eina_array_free(spin->free_particles); - EINA_LIST_FOREACH(spin->sys_fifo, l, particle) eiotas_particle_free(particle); - eina_list_free(spin->sys_fifo); - EINA_LIST_FOREACH(spin->app_fifo, l, particle) eiotas_particle_free(particle); - eina_list_free(spin->app_fifo); + EINA_INLIST_FOREACH_SAFE(spin->sys_fifo, list,particle) eiotas_particle_free(particle); + EINA_INLIST_FOREACH_SAFE(spin->app_fifo, list,particle) eiotas_particle_free(particle); free(spin); } @@ -78,9 +75,9 @@ EAPI void eiotas_spin_release_particle(Eiotas_Spin *spin, Eiotas_Particle *parti EAPI void eiotas_spin_send_particle(Eiotas_Spin *spin, Eiotas_Particle *particle, Eina_Bool system) { if(system) { - spin->sys_fifo = eina_list_append(spin->sys_fifo,particle); + spin->sys_fifo = eina_inlist_append(spin->sys_fifo,EINA_INLIST_GET(particle)); } else { - spin->app_fifo = eina_list_append(spin->app_fifo,particle); + spin->app_fifo = eina_inlist_append(spin->app_fifo,EINA_INLIST_GET(particle)); } } -- cgit v1.1-2-g2b99