From 22c2aef77c63cf4cbe19a1c5a8ea4671ef6440bd Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 1 May 2011 06:34:40 +0000 Subject: replace inline string searches with BLI_findstring(), strcmp(..., ""), with char comparisons. --- source/blender/blenkernel/intern/idprop.c | 49 ++++++++++++++----------------- 1 file changed, 22 insertions(+), 27 deletions(-) (limited to 'source/blender/blenkernel/intern/idprop.c') diff --git a/source/blender/blenkernel/intern/idprop.c b/source/blender/blenkernel/intern/idprop.c index 80962de9730..04fc41e41cc 100644 --- a/source/blender/blenkernel/intern/idprop.c +++ b/source/blender/blenkernel/intern/idprop.c @@ -426,35 +426,30 @@ static IDProperty *IDP_CopyGroup(IDProperty *prop) * When values name and types match, copy the values, else ignore */ void IDP_SyncGroupValues(IDProperty *dest, IDProperty *src) { - IDProperty *loop, *prop; + IDProperty *other, *prop; for (prop=src->data.group.first; prop; prop=prop->next) { - for (loop=dest->data.group.first; loop; loop=loop->next) { - if (strcmp(loop->name, prop->name)==0) { - if(prop->type==loop->type) { - - switch (prop->type) { - case IDP_INT: - case IDP_FLOAT: - case IDP_DOUBLE: - loop->data= prop->data; - break; - case IDP_GROUP: - IDP_SyncGroupValues(loop, prop); - break; - default: - { - IDProperty *tmp= loop; - IDProperty *copy= IDP_CopyProperty(prop); - - BLI_insertlinkafter(&dest->data.group, loop, copy); - BLI_remlink(&dest->data.group, tmp); - - IDP_FreeProperty(tmp); - MEM_freeN(tmp); - } - } + other= BLI_findstring(&dest->data.group, prop->name, offsetof(IDProperty, name)); + if (other && prop->type==other->type) { + switch (prop->type) { + case IDP_INT: + case IDP_FLOAT: + case IDP_DOUBLE: + other->data= prop->data; + break; + case IDP_GROUP: + IDP_SyncGroupValues(other, prop); + break; + default: + { + IDProperty *tmp= other; + IDProperty *copy= IDP_CopyProperty(prop); + + BLI_insertlinkafter(&dest->data.group, other, copy); + BLI_remlink(&dest->data.group, tmp); + + IDP_FreeProperty(tmp); + MEM_freeN(tmp); } - break; } } } -- cgit v1.2.3