diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2012-06-01 11:03:00 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2012-06-01 11:03:00 +0200 |
commit | 1be871be95118d674e32aa389822b35e8a66fd6f (patch) | |
tree | 662fed7a12e16b2ff284f01ada854e876d7d0f34 | |
parent | 090d38ec3cfff930366327fe7460aecb00ffaa02 (diff) | |
download | edoors-1be871be95118d674e32aa389822b35e8a66fd6f.zip edoors-1be871be95118d674e32aa389822b35e8a66fd6f.tar.gz |
Particle : optimize update_link_value
-rw-r--r-- | src/lib/eiotas_particle.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/lib/eiotas_particle.c b/src/lib/eiotas_particle.c index ea00b5c..5f302cf 100644 --- a/src/lib/eiotas_particle.c +++ b/src/lib/eiotas_particle.c @@ -229,7 +229,18 @@ static void update_link_value(Eiotas_Particle *particle, const char *field) } *dst='\0'; - if(particle->link_value) eina_stringshare_del(particle->link_value); - particle->link_value = ( (t==1) ? NULL : eina_stringshare_add(tmp) ); + if(particle->link_value) { + if(t==1) { + eina_stringshare_del(particle->link_value); + particle->link_value = NULL; + } else if(strcmp(particle->link_value,tmp)!=0) { + eina_stringshare_del(particle->link_value); + particle->link_value = eina_stringshare_add(tmp); + } + /* else : keep the same stringshare */ + } else if(t!=1) { + particle->link_value = eina_stringshare_add(tmp); + } + /* else : keep particle->link_value=NULL*/ } |