Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Poirier <theeth@yahoo.com>2010-01-22 00:01:18 +0300
committerMartin Poirier <theeth@yahoo.com>2010-01-22 00:01:18 +0300
commit0d4583365a84078fac8351925b5caa663d64a108 (patch)
treead6002ec7a71bd86d24e81508c4b952f94a8c394 /source/blender/blenkernel/intern/idprop.c
parent8f3f1da08065f725097f23e758ca21634bb03d7a (diff)
Fix bug in IDP_ReplaceGroupInGroup (it would sometimes add the same property twice).
Also simplify some other loops.
Diffstat (limited to 'source/blender/blenkernel/intern/idprop.c')
-rw-r--r--source/blender/blenkernel/intern/idprop.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/source/blender/blenkernel/intern/idprop.c b/source/blender/blenkernel/intern/idprop.c
index ddfb28437a9..c2e4dbb6c09 100644
--- a/source/blender/blenkernel/intern/idprop.c
+++ b/source/blender/blenkernel/intern/idprop.c
@@ -392,12 +392,11 @@ void IDP_ReplaceGroupInGroup(IDProperty *dest, IDProperty *src)
{
IDProperty *loop, *prop;
for (prop=src->data.group.first; prop; prop=prop->next) {
- IDProperty *copy = IDP_CopyProperty(prop);
-
for (loop=dest->data.group.first; loop; loop=loop->next) {
if (BSTR_EQ(loop->name, prop->name)) {
- if (loop->next) BLI_insertlinkbefore(&dest->data.group, loop->next, copy);
- else BLI_addtail(&dest->data.group, copy);
+ IDProperty *copy = IDP_CopyProperty(prop);
+
+ BLI_insertlink(&dest->data.group, loop, copy);
BLI_remlink(&dest->data.group, loop);
IDP_FreeProperty(loop);
@@ -406,8 +405,12 @@ void IDP_ReplaceGroupInGroup(IDProperty *dest, IDProperty *src)
}
}
- dest->len++;
- BLI_addtail(&dest->data.group, copy);
+ /* only add at end if not added yet */
+ if (loop == NULL) {
+ IDProperty *copy = IDP_CopyProperty(prop);
+ dest->len++;
+ BLI_addtail(&dest->data.group, copy);
+ }
}
}
/*
@@ -419,8 +422,7 @@ void IDP_ReplaceInGroup(IDProperty *group, IDProperty *prop)
IDProperty *loop;
for (loop=group->data.group.first; loop; loop=loop->next) {
if (BSTR_EQ(loop->name, prop->name)) {
- if (loop->next) BLI_insertlinkbefore(&group->data.group, loop->next, prop);
- else BLI_addtail(&group->data.group, prop);
+ BLI_insertlink(&group->data.group, loop, prop);
BLI_remlink(&group->data.group, loop);
IDP_FreeProperty(loop);
@@ -513,14 +515,12 @@ void IDP_FreeIterBeforeEnd(void *vself)
direct data.*/
static void IDP_FreeGroup(IDProperty *prop)
{
- IDProperty *loop, *next;
- for (loop=prop->data.group.first; loop; loop=next)
+ IDProperty *loop;
+ for (loop=prop->data.group.first; loop; loop=loop->next)
{
- next = loop->next;
- BLI_remlink(&prop->data.group, loop);
IDP_FreeProperty(loop);
- MEM_freeN(loop);
}
+ BLI_freelistN(&prop->data.group);
}