From 47ebd0755b665af8e460ad9ef58c8982c9bae6ad Mon Sep 17 00:00:00 2001 From: Johan Dahlin Date: Sat, 8 Jan 2011 12:07:55 -0200 Subject: [PATCH] iterator: store size in the struct https://bugzilla.gnome.org/show_bug.cgi?id=638987 --- gst/gstiterator.c | 12 +++++++----- gst/gstiterator.h | 3 ++- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/gst/gstiterator.c b/gst/gstiterator.c index f6162828dd..0f1701dcdd 100644 --- a/gst/gstiterator.c +++ b/gst/gstiterator.c @@ -71,13 +71,14 @@ #include "gst_private.h" #include -/* FIXME 0.11: Store the size inside the iterator, use GSlice for allocation - * and let gst_iterator_free() free the memory while the free-func only frees - * additional resources (maybe call it finalize?). +/* FIXME 0.11: use GSlice for allocation and let gst_iterator_free() free + * the memory while the free-func only frees additional resources + * (maybe call it finalize?). */ static void gst_iterator_init (GstIterator * it, + guint size, GType type, GMutex * lock, guint32 * master_cookie, @@ -85,6 +86,7 @@ gst_iterator_init (GstIterator * it, GstIteratorItemFunction item, GstIteratorResyncFunction resync, GstIteratorFreeFunction free) { + it->size = size; it->type = type; it->lock = lock; it->master_cookie = master_cookie; @@ -137,8 +139,8 @@ gst_iterator_new (guint size, g_return_val_if_fail (free != NULL, NULL); result = g_malloc (size); - gst_iterator_init (result, type, lock, master_cookie, next, item, resync, - free); + gst_iterator_init (result, size, type, lock, master_cookie, next, item, + resync, free); return result; } diff --git a/gst/gstiterator.h b/gst/gstiterator.h index b8af00a1bd..874ae41d12 100644 --- a/gst/gstiterator.h +++ b/gst/gstiterator.h @@ -216,9 +216,10 @@ struct _GstIterator { guint32 cookie; /* cookie of the iterator */ guint32 *master_cookie; /* pointer to guint32 holding the cookie when this iterator was created */ + guint size; /*< private >*/ - gpointer _gst_reserved[GST_PADDING]; + gpointer _gst_reserved[GST_PADDING-1]; }; /* creating iterators */