diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2012-05-25 16:52:43 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2012-05-25 16:52:43 +0200 |
commit | 0a233ef23e8c6209a532eed6fecceb01e7a9c3c8 (patch) | |
tree | 10cb9b42bb3665d4eba5556f4deb59b8c541877c /src/lib | |
parent | 6f22eec5d62d0d6c57ab2e5e257ca907ee77125b (diff) | |
download | edoors-0a233ef23e8c6209a532eed6fecceb01e7a9c3c8.zip edoors-0a233ef23e8c6209a532eed6fecceb01e7a9c3c8.tar.gz |
Particle: define and implement eiotas_particle _reset, _init, _merge
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/eiotas_particle.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/lib/eiotas_particle.c b/src/lib/eiotas_particle.c index 079caf1..4927e90 100644 --- a/src/lib/eiotas_particle.c +++ b/src/lib/eiotas_particle.c @@ -56,3 +56,36 @@ void eiotas_particle_free(Eiotas_Particle *particle) free(particle); } +EAPI void eiotas_particle_reset(Eiotas_Particle *particle) +{ + unsigned int i; + char *s; + Eiotas_Particle *p; + Eina_Inlist *li; + Eina_Array_Iterator it; + + particle->ts = 0; + particle->src = NULL; + particle->dst = NULL; + EINA_ARRAY_ITER_NEXT(particle->dsts, i, s, it) free(s); + eina_array_clean(particle->dsts); + eina_hash_free_buckets(particle->payload); + EINA_INLIST_FOREACH_SAFE(particle->merged, li, p) eiotas_particle_free(p); + particle->merged = NULL; + EINA_ARRAY_ITER_NEXT(particle->link_fields, i, s, it) free(s); + eina_array_clean(particle->link_fields); + if(particle->link_value) eina_stringshare_del(particle->link_value); + particle->link_value = NULL; +} + +EAPI void eiotas_particle_init(Eiotas_Particle *particle, Eiotas_Iota *iota) +{ + particle->src = iota; + particle->ts = time(NULL); +} + +EAPI void eiotas_particle_merge(Eiotas_Particle *particle, Eiotas_Particle *p) +{ + particle->merged = eina_inlist_append(particle->merged, EINA_INLIST_GET(p)); +} + |