Cleanup: remove rarely used IDProp iterator
This commit is contained in:
parent
f7e220edbd
commit
4b3f1b7540
|
@ -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();
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue