iterator: register as a boxed type
authorJohan Dahlin <johan@gnome.org>
Sat, 8 Jan 2011 14:27:55 +0000 (12:27 -0200)
committerSebastian Dröge <sebastian.droege@collabora.co.uk>
Thu, 5 May 2011 13:33:29 +0000 (15:33 +0200)
https://bugzilla.gnome.org/show_bug.cgi?id=638987

gst/gstiterator.c
gst/gstiterator.h

index bff8e2e..7e13414 100644 (file)
 #include "gst_private.h"
 #include <gst/gstiterator.h>
 
+static GstIterator *
+gst_iterator_copy (GstIterator * it)
+{
+  return g_slice_copy (it->size, it);
+}
+
+GType
+gst_iterator_get_type (void)
+{
+  static GType type = 0;
+
+  if (G_UNLIKELY (type == 0))
+    type = g_boxed_type_register_static ("GstIterator",
+        (GBoxedCopyFunc) gst_iterator_copy, (GBoxedFreeFunc) gst_iterator_free);
+  return type;
+}
+
 static void
 gst_iterator_init (GstIterator * it,
     guint size,
index 874ae41..701c267 100644 (file)
@@ -27,6 +27,8 @@
 
 G_BEGIN_DECLS
 
+#define GST_TYPE_ITERATOR (gst_iterator_get_type ())
+
 /**
  * GstIteratorResult:
  * @GST_ITERATOR_DONE:   No more items in the iterator
@@ -222,6 +224,8 @@ struct _GstIterator {
   gpointer _gst_reserved[GST_PADDING-1];
 };
 
+GType                   gst_iterator_get_type           (void);
+
 /* creating iterators */
 GstIterator*           gst_iterator_new                (guint size,
                                                         GType type,