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:
authorJacques Lucke <jacques@blender.org>2020-09-09 17:35:20 +0300
committerJacques Lucke <jacques@blender.org>2020-09-09 17:36:57 +0300
commitf8aad78830c185af50ab08f9362d637a23746447 (patch)
tree414d60581b68b20d85381817ea312a554a25b564 /source/blender/blenkernel/intern/idprop.c
parent42e3eb8854c9495a197fd5fa9d0f7990c24cafa7 (diff)
Cleanup: reduce variable scopes
Diffstat (limited to 'source/blender/blenkernel/intern/idprop.c')
-rw-r--r--source/blender/blenkernel/intern/idprop.c23
1 files changed, 7 insertions, 16 deletions
diff --git a/source/blender/blenkernel/intern/idprop.c b/source/blender/blenkernel/intern/idprop.c
index 7195ebda5ff..189eef5e175 100644
--- a/source/blender/blenkernel/intern/idprop.c
+++ b/source/blender/blenkernel/intern/idprop.c
@@ -95,7 +95,6 @@ IDProperty *IDP_CopyIDPArray(const IDProperty *array, const int flag)
{
/* don't use MEM_dupallocN because this may be part of an array */
IDProperty *narray, *tmp;
- int i;
BLI_assert(array->type == IDP_IDPARRAY);
@@ -103,7 +102,7 @@ IDProperty *IDP_CopyIDPArray(const IDProperty *array, const int flag)
*narray = *array;
narray->data.pointer = MEM_dupallocN(array->data.pointer);
- for (i = 0; i < narray->len; i++) {
+ for (int i = 0; i < narray->len; i++) {
/* ok, the copy functions always allocate a new structure,
* which doesn't work here. instead, simply copy the
* contents of the new structure into the array cell,
@@ -120,11 +119,9 @@ IDProperty *IDP_CopyIDPArray(const IDProperty *array, const int flag)
static void IDP_FreeIDPArray(IDProperty *prop, const bool do_id_user)
{
- int i;
-
BLI_assert(prop->type == IDP_IDPARRAY);
- for (i = 0; i < prop->len; i++) {
+ for (int i = 0; i < prop->len; i++) {
IDP_FreePropertyContent_ex(GETPROP(prop, i), do_id_user);
}
@@ -176,9 +173,7 @@ void IDP_ResizeIDPArray(IDProperty *prop, int newlen)
/* first check if the array buffer size has room */
if (newlen <= prop->totallen) {
if (newlen < prop->len && prop->totallen - newlen < IDP_ARRAY_REALLOC_LIMIT) {
- int i;
-
- for (i = newlen; i < prop->len; i++) {
+ for (int i = newlen; i < prop->len; i++) {
IDP_FreePropertyContent(GETPROP(prop, i));
}
@@ -194,8 +189,7 @@ void IDP_ResizeIDPArray(IDProperty *prop, int newlen)
/* free trailing items */
if (newlen < prop->len) {
/* newlen is smaller */
- int i;
- for (i = newlen; i < prop->len; i++) {
+ for (int i = newlen; i < prop->len; i++) {
IDP_FreePropertyContent(GETPROP(prop, i));
}
}
@@ -921,13 +915,12 @@ bool IDP_EqualsProperties_ex(IDProperty *prop1, IDProperty *prop2, const bool is
case IDP_IDPARRAY: {
IDProperty *array1 = IDP_IDPArray(prop1);
IDProperty *array2 = IDP_IDPArray(prop2);
- int i;
if (prop1->len != prop2->len) {
return false;
}
- for (i = 0; i < prop1->len; i++) {
+ for (int i = 0; i < prop1->len; i++) {
if (!IDP_EqualsProperties_ex(&array1[i], &array2[i], is_strict)) {
return false;
}
@@ -1253,7 +1246,6 @@ static void IDP_DirectLinkProperty(IDProperty *prop, BlendDataReader *reader);
static void IDP_DirectLinkIDPArray(IDProperty *prop, BlendDataReader *reader)
{
IDProperty *array;
- int i;
/* since we didn't save the extra buffer, set totallen to len */
prop->totallen = prop->len;
@@ -1268,7 +1260,7 @@ static void IDP_DirectLinkIDPArray(IDProperty *prop, BlendDataReader *reader)
prop->totallen = 0;
}
- for (i = 0; i < prop->len; i++) {
+ for (int i = 0; i < prop->len; i++) {
IDP_DirectLinkProperty(&array[i], reader);
}
}
@@ -1276,7 +1268,6 @@ static void IDP_DirectLinkIDPArray(IDProperty *prop, BlendDataReader *reader)
static void IDP_DirectLinkArray(IDProperty *prop, BlendDataReader *reader)
{
IDProperty **array;
- int i;
/* since we didn't save the extra buffer, set totallen to len */
prop->totallen = prop->len;
@@ -1285,7 +1276,7 @@ static void IDP_DirectLinkArray(IDProperty *prop, BlendDataReader *reader)
BLO_read_pointer_array(reader, &prop->data.pointer);
array = prop->data.pointer;
- for (i = 0; i < prop->len; i++) {
+ for (int i = 0; i < prop->len; i++) {
IDP_DirectLinkProperty(array[i], reader);
}
}