From 8a7f2b24c1aa3a76637a1ae3b01a2f074755803c Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 12 Dec 2013 21:57:37 +1100 Subject: Code Cleanup: use const's and bools for idprops --- source/blender/blenkernel/intern/idprop.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 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 594c918b4c2..785069cd150 100644 --- a/source/blender/blenkernel/intern/idprop.c +++ b/source/blender/blenkernel/intern/idprop.c @@ -81,7 +81,7 @@ IDProperty *IDP_NewIDPArray(const char *name) return prop; } -IDProperty *IDP_CopyIDPArray(IDProperty *array) +IDProperty *IDP_CopyIDPArray(const IDProperty *array) { /* don't use MEM_dupallocN because this may be part of an array */ IDProperty *narray, *tmp; @@ -273,7 +273,7 @@ void IDP_FreeArray(IDProperty *prop) } -static IDProperty *idp_generic_copy(IDProperty *prop) +static IDProperty *idp_generic_copy(const IDProperty *prop) { IDProperty *newp = MEM_callocN(sizeof(IDProperty), "IDProperty array dup"); @@ -286,7 +286,7 @@ static IDProperty *idp_generic_copy(IDProperty *prop) return newp; } -static IDProperty *IDP_CopyArray(IDProperty *prop) +static IDProperty *IDP_CopyArray(const IDProperty *prop) { IDProperty *newp = idp_generic_copy(prop); @@ -352,7 +352,7 @@ IDProperty *IDP_NewString(const char *st, const char *name, int maxlen) return prop; } -static IDProperty *IDP_CopyString(IDProperty *prop) +static IDProperty *IDP_CopyString(const IDProperty *prop) { IDProperty *newp; @@ -453,7 +453,7 @@ void IDP_UnlinkID(IDProperty *prop) /** * Checks if a property with the same name as prop exists, and if so replaces it. */ -static IDProperty *IDP_CopyGroup(IDProperty *prop) +static IDProperty *IDP_CopyGroup(const IDProperty *prop) { IDProperty *newp, *link; @@ -470,7 +470,7 @@ static IDProperty *IDP_CopyGroup(IDProperty *prop) /* use for syncing proxies. * When values name and types match, copy the values, else ignore */ -void IDP_SyncGroupValues(IDProperty *dest, IDProperty *src) +void IDP_SyncGroupValues(IDProperty *dest, const IDProperty *src) { IDProperty *other, *prop; @@ -509,7 +509,7 @@ void IDP_SyncGroupValues(IDProperty *dest, IDProperty *src) /** * Replaces all properties with the same name in a destination group from a source group. */ -void IDP_ReplaceGroupInGroup(IDProperty *dest, IDProperty *src) +void IDP_ReplaceGroupInGroup(IDProperty *dest, const IDProperty *src) { IDProperty *loop, *prop; @@ -565,7 +565,7 @@ void IDP_ReplaceInGroup(IDProperty *group, IDProperty *prop) /** * If a property is missing in \a dest, add it. */ -void IDP_MergeGroup(IDProperty *dest, IDProperty *src, const int do_overwrite) +void IDP_MergeGroup(IDProperty *dest, const IDProperty *src, const bool do_overwrite) { IDProperty *prop; @@ -604,7 +604,7 @@ void IDP_MergeGroup(IDProperty *dest, IDProperty *src, const int do_overwrite) * struct. In the future this will just be IDP_FreeProperty and the code will * be reorganized to work properly. */ -int IDP_AddToGroup(IDProperty *group, IDProperty *prop) +bool IDP_AddToGroup(IDProperty *group, IDProperty *prop) { BLI_assert(group->type == IDP_GROUP); @@ -621,7 +621,7 @@ int IDP_AddToGroup(IDProperty *group, IDProperty *prop) * This is the same as IDP_AddToGroup, only you pass an item * in the group list to be inserted after. */ -int IDP_InsertToGroup(IDProperty *group, IDProperty *previous, IDProperty *pnew) +bool IDP_InsertToGroup(IDProperty *group, IDProperty *previous, IDProperty *pnew) { BLI_assert(group->type == IDP_GROUP); @@ -744,7 +744,7 @@ static void IDP_FreeGroup(IDProperty *prop) /** \name IDProperty Main API * \{ */ -IDProperty *IDP_CopyProperty(IDProperty *prop) +IDProperty *IDP_CopyProperty(const IDProperty *prop) { switch (prop->type) { case IDP_GROUP: return IDP_CopyGroup(prop); @@ -760,7 +760,7 @@ IDProperty *IDP_CopyProperty(IDProperty *prop) * to create the Group property and attach it to id if it doesn't exist; otherwise * the function will return NULL if there's no Group property attached to the ID. */ -IDProperty *IDP_GetProperties(ID *id, int create_if_needed) +IDProperty *IDP_GetProperties(ID *id, const bool create_if_needed) { if (id->properties) { return id->properties; @@ -780,7 +780,7 @@ IDProperty *IDP_GetProperties(ID *id, int create_if_needed) /** * \param is_strict When FALSE treat missing items as a match */ -int IDP_EqualsProperties_ex(IDProperty *prop1, IDProperty *prop2, const int is_strict) +bool IDP_EqualsProperties_ex(IDProperty *prop1, IDProperty *prop2, const bool is_strict) { if (prop1 == NULL && prop2 == NULL) return 1; @@ -842,7 +842,7 @@ int IDP_EqualsProperties_ex(IDProperty *prop1, IDProperty *prop2, const int is_s return 1; } -int IDP_EqualsProperties(IDProperty *prop1, IDProperty *prop2) +bool IDP_EqualsProperties(IDProperty *prop1, IDProperty *prop2) { return IDP_EqualsProperties_ex(prop1, prop2, TRUE); } -- cgit v1.2.3