diff options
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenkernel/BKE_idprop.h | 3 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/idprop.c | 12 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/writeffmpeg.c | 4 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_access.c | 16 | ||||
-rw-r--r-- | source/blender/python/generic/idprop_py_api.c | 6 |
5 files changed, 20 insertions, 21 deletions
diff --git a/source/blender/blenkernel/BKE_idprop.h b/source/blender/blenkernel/BKE_idprop.h index 71fd163a8ee..bd90960eced 100644 --- a/source/blender/blenkernel/BKE_idprop.h +++ b/source/blender/blenkernel/BKE_idprop.h @@ -94,7 +94,8 @@ void IDP_MergeGroup(IDProperty *dest, IDProperty *src, const int do_overwrite) A int IDP_AddToGroup(struct IDProperty *group, struct IDProperty *prop) ATTR_NONNULL(); int IDP_InsertToGroup(struct IDProperty *group, struct IDProperty *previous, struct IDProperty *pnew) ATTR_NONNULL(1 /* group */, 3 /* pnew */); -void IDP_RemFromGroup(struct IDProperty *group, struct IDProperty *prop) ATTR_NONNULL(); +void IDP_RemoveFromGroup(struct IDProperty *group, struct IDProperty *prop) ATTR_NONNULL(); +void IDP_FreeFromGroup(struct IDProperty *group, struct IDProperty *prop) ATTR_NONNULL(); IDProperty *IDP_GetPropertyFromGroup(struct IDProperty *prop, const char *name) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); IDProperty *IDP_GetPropertyTypeFromGroup(struct IDProperty *prop, const char *name, const char type) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); diff --git a/source/blender/blenkernel/intern/idprop.c b/source/blender/blenkernel/intern/idprop.c index 6f275e4ec75..594c918b4c2 100644 --- a/source/blender/blenkernel/intern/idprop.c +++ b/source/blender/blenkernel/intern/idprop.c @@ -641,7 +641,7 @@ int IDP_InsertToGroup(IDProperty *group, IDProperty *previous, IDProperty *pnew) * IDP_FreeProperty(prop); //free all subdata * MEM_freeN(prop); //free property struct itself */ -void IDP_RemFromGroup(IDProperty *group, IDProperty *prop) +void IDP_RemoveFromGroup(IDProperty *group, IDProperty *prop) { BLI_assert(group->type == IDP_GROUP); @@ -649,6 +649,16 @@ void IDP_RemFromGroup(IDProperty *group, IDProperty *prop) BLI_remlink(&group->data.group, prop); } +/** + * Removes the property from the group and frees it. + */ +void IDP_FreeFromGroup(IDProperty *group, IDProperty *prop) +{ + IDP_RemoveFromGroup(group, prop); + IDP_FreeProperty(prop); + MEM_freeN(prop); +} + IDProperty *IDP_GetPropertyFromGroup(IDProperty *prop, const char *name) { BLI_assert(prop->type == IDP_GROUP); diff --git a/source/blender/blenkernel/intern/writeffmpeg.c b/source/blender/blenkernel/intern/writeffmpeg.c index 538c98cc899..ebd6bc01bea 100644 --- a/source/blender/blenkernel/intern/writeffmpeg.c +++ b/source/blender/blenkernel/intern/writeffmpeg.c @@ -1254,9 +1254,7 @@ void BKE_ffmpeg_property_del(RenderData *rd, void *type, void *prop_) group = IDP_GetPropertyFromGroup(rd->ffcodecdata.properties, type); if (group && prop) { - IDP_RemFromGroup(group, prop); - IDP_FreeProperty(prop); - MEM_freeN(prop); + IDP_FreeFromGroup(group, prop); } } diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c index 9a8533ec6a1..fe457a14718 100644 --- a/source/blender/makesrna/intern/rna_access.c +++ b/source/blender/makesrna/intern/rna_access.c @@ -290,9 +290,7 @@ static void rna_idproperty_free(PointerRNA *ptr, const char *name) if (group) { IDProperty *idprop = IDP_GetPropertyFromGroup(group, name); if (idprop) { - IDP_RemFromGroup(group, idprop); - IDP_FreeProperty(idprop); - MEM_freeN(idprop); + IDP_FreeFromGroup(group, idprop); } } } @@ -423,9 +421,7 @@ IDProperty *rna_idproperty_check(PropertyRNA **prop, PointerRNA *ptr) if (idprop && !rna_idproperty_verify_valid(ptr, *prop, idprop)) { IDProperty *group = RNA_struct_idprops(ptr, 0); - IDP_RemFromGroup(group, idprop); - IDP_FreeProperty(idprop); - MEM_freeN(idprop); + IDP_FreeFromGroup(group, idprop); return NULL; } @@ -596,9 +592,7 @@ bool RNA_struct_idprops_unset(PointerRNA *ptr, const char *identifier) if (group) { IDProperty *idp = IDP_GetPropertyFromGroup(group, identifier); if (idp) { - IDP_RemFromGroup(group, idp); - IDP_FreeProperty(idp); - MEM_freeN(idp); + IDP_FreeFromGroup(group, idp); return true; } @@ -2771,9 +2765,7 @@ void RNA_property_pointer_remove(PointerRNA *ptr, PropertyRNA *prop) group = RNA_struct_idprops(ptr, 0); if (group) { - IDP_RemFromGroup(group, idprop); - IDP_FreeProperty(idprop); - MEM_freeN(idprop); + IDP_FreeFromGroup(group, idprop); } } else diff --git a/source/blender/python/generic/idprop_py_api.c b/source/blender/python/generic/idprop_py_api.c index f7ed5fec891..92e9f49769d 100644 --- a/source/blender/python/generic/idprop_py_api.c +++ b/source/blender/python/generic/idprop_py_api.c @@ -496,9 +496,7 @@ int BPy_Wrap_SetMapItem(IDProperty *prop, PyObject *key, PyObject *val) if (val == NULL) { /* del idprop[key] */ IDProperty *pkey = IDP_GetPropertyFromGroup(prop, _PyUnicode_AsString(key)); if (pkey) { - IDP_RemFromGroup(prop, pkey); - IDP_FreeProperty(pkey); - MEM_freeN(pkey); + IDP_FreeFromGroup(prop, pkey); return 0; } else { @@ -670,7 +668,7 @@ static PyObject *BPy_IDGroup_Pop(BPy_IDProperty *self, PyObject *value) return NULL; } - IDP_RemFromGroup(self->prop, idprop); + IDP_RemoveFromGroup(self->prop, idprop); return pyform; } |