caps: no need to store the size of the caps structure inside the structure

This commit is contained in:
Tim-Philipp Müller 2012-06-14 23:45:14 +01:00
parent 2677f9b56d
commit 463268b21f

View file

@ -75,12 +75,9 @@ typedef struct _GstCapsImpl
{
GstCaps caps;
gsize slice_size;
GPtrArray *array;
} GstCapsImpl;
#define GST_CAPS_SLICE_SIZE(c) (((GstCapsImpl *)(c))->slice_size)
#define GST_CAPS_ARRAY(c) (((GstCapsImpl *)(c))->array)
#define GST_CAPS_LEN(c) (GST_CAPS_ARRAY(c)->len)
@ -182,11 +179,11 @@ _gst_caps_free (GstCaps * caps)
#ifdef DEBUG_REFCOUNT
GST_CAT_TRACE (GST_CAT_CAPS, "freeing caps %p", caps);
#endif
g_slice_free1 (GST_CAPS_SLICE_SIZE (caps), caps);
g_slice_free1 (sizeof (GstCapsImpl), caps);
}
static void
gst_caps_init (GstCaps * caps, gsize size)
gst_caps_init (GstCaps * caps)
{
gst_mini_object_init (GST_MINI_OBJECT_CAST (caps), _gst_caps_type);
@ -194,7 +191,6 @@ gst_caps_init (GstCaps * caps, gsize size)
caps->mini_object.dispose = NULL;
caps->mini_object.free = (GstMiniObjectFreeFunction) _gst_caps_free;
GST_CAPS_SLICE_SIZE (caps) = size;
/* the 32 has been determined by logging caps sizes in _gst_caps_free
* but g_ptr_array uses 16 anyway if it expands once, so this does not help
* in practice
@ -220,7 +216,7 @@ gst_caps_new_empty (void)
caps = (GstCaps *) g_slice_new (GstCapsImpl);
gst_caps_init (caps, sizeof (GstCapsImpl));
gst_caps_init (caps);
#ifdef DEBUG_REFCOUNT
GST_CAT_TRACE (GST_CAT_CAPS, "created caps %p", caps);