[Bf-blender-cvs] [4b3f1b7] master: Cleanup: remove rarely used IDProp iterator

Campbell Barton noreply at git.blender.org
Mon Nov 3 17:06:39 CET 2014


Commit: 4b3f1b7540c43999b94c5147eabd6b0b7a6693f8
Author: Campbell Barton
Date:   Mon Nov 3 17:04:12 2014 +0100
Branches: master
https://developer.blender.org/rB4b3f1b7540c43999b94c5147eabd6b0b7a6693f8

Cleanup: remove rarely used IDProp iterator

===================================================================

M	source/blender/blenkernel/BKE_idprop.h
M	source/blender/blenkernel/intern/idprop.c
M	source/blender/blenkernel/intern/writeffmpeg.c

===================================================================

diff --git a/source/blender/blenkernel/BKE_idprop.h b/source/blender/blenkernel/BKE_idprop.h
index 2ab3d84..cb73cc2 100644
--- a/source/blender/blenkernel/BKE_idprop.h
+++ b/source/blender/blenkernel/BKE_idprop.h
@@ -100,9 +100,6 @@ void IDP_FreeFromGroup(struct IDProperty *group, struct IDProperty *prop) ATTR_N
 
 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();
-void *IDP_GetGroupIterator(struct IDProperty *prop) ATTR_WARN_UNUSED_RESULT;
-IDProperty *IDP_GroupIterNext(void *vself) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
-void IDP_FreeIterBeforeEnd(void *vself) ATTR_NONNULL();
 
 /*-------- Main Functions --------*/
 struct IDProperty *IDP_GetProperties(struct ID *id, const bool create_if_needed) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
diff --git a/source/blender/blenkernel/intern/idprop.c b/source/blender/blenkernel/intern/idprop.c
index 4dbd15a..5c06d5b 100644
--- a/source/blender/blenkernel/intern/idprop.c
+++ b/source/blender/blenkernel/intern/idprop.c
@@ -700,56 +700,6 @@ IDProperty *IDP_GetPropertyTypeFromGroup(IDProperty *prop, const char *name, con
 	return (idprop && idprop->type == type) ? idprop : NULL;
 }
 
-typedef struct IDPIter {
-	void *next;
-	IDProperty *parent;
-} IDPIter;
-
-/**
- * Get an iterator to iterate over the members of an id property group.
- * Note that this will automatically free the iterator once iteration is complete;
- * if you stop the iteration before hitting the end, make sure to call
- * IDP_FreeIterBeforeEnd().
- */
-void *IDP_GetGroupIterator(IDProperty *prop)
-{
-	IDPIter *iter;
-
-	BLI_assert(prop->type == IDP_GROUP);
-	iter = MEM_mallocN(sizeof(IDPIter), "IDPIter");
-	iter->next = prop->data.group.first;
-	iter->parent = prop;
-	return (void *) iter;
-}
-
-/**
- * Returns the next item in the iteration.  To use, simple for a loop like the following:
- * while (IDP_GroupIterNext(iter) != NULL) {
- *     ...
- * }
- */
-IDProperty *IDP_GroupIterNext(void *vself)
-{
-	IDPIter *self = (IDPIter *) vself;
-	Link *next = (Link *) self->next;
-	if (self->next == NULL) {
-		MEM_freeN(self);
-		return NULL;
-	}
-
-	self->next = next->next;
-	return (void *) next;
-}
-
-/**
- * Frees the iterator pointed to at vself, only use this if iteration is stopped early;
- * when the iterator hits the end of the list it'll automatically free itself.\
- */
-void IDP_FreeIterBeforeEnd(void *vself)
-{
-	MEM_freeN(vself);
-}
-
 /* Ok, the way things work, Groups free the ID Property structs of their children.
  * This is because all ID Property freeing functions free only direct data (not the ID Property
  * struct itself), but for Groups the child properties *are* considered
diff --git a/source/blender/blenkernel/intern/writeffmpeg.c b/source/blender/blenkernel/intern/writeffmpeg.c
index 739db7b..1fe5d34 100644
--- a/source/blender/blenkernel/intern/writeffmpeg.c
+++ b/source/blender/blenkernel/intern/writeffmpeg.c
@@ -484,7 +484,6 @@ static void set_ffmpeg_properties(RenderData *rd, AVCodecContext *c, const char
                                   AVDictionary **dictionary)
 {
 	IDProperty *prop;
-	void *iter;
 	IDProperty *curr;
 
 	/* TODO(sergey): This is actually rather stupid, because changing
@@ -509,9 +508,7 @@ static void set_ffmpeg_properties(RenderData *rd, AVCodecContext *c, const char
 		return;
 	}
 
-	iter = IDP_GetGroupIterator(prop);
-
-	while ((curr = IDP_GroupIterNext(iter)) != NULL) {
+	for (curr = prop->data.group.first; curr; curr = curr->next) {
 		if (ffmpeg_proprty_valid(c, prop_name, curr))
 			set_ffmpeg_property_option(c, curr, dictionary);
 	}




More information about the Bf-blender-cvs mailing list