query: no need to store the size of the structure inside the structure
authorTim-Philipp Müller <tim.muller@collabora.co.uk>
Thu, 14 Jun 2012 22:54:22 +0000 (23:54 +0100)
committerTim-Philipp Müller <tim.muller@collabora.co.uk>
Fri, 15 Jun 2012 09:26:57 +0000 (10:26 +0100)
gst/gstquery.c

index 694113c..9304742 100644 (file)
@@ -77,12 +77,10 @@ static GType _gst_query_type = 0;
 typedef struct
 {
   GstQuery query;
-  gsize slice_size;
 
   GstStructure *structure;
 } GstQueryImpl;
 
-#define GST_QUERY_SLICE_SIZE(q) (((GstQueryImpl *)(q))->slice_size)
 #define GST_QUERY_STRUCTURE(q)  (((GstQueryImpl *)(q))->structure)
 
 
@@ -204,7 +202,7 @@ _gst_query_free (GstQuery * query)
     gst_structure_free (s);
   }
 
-  g_slice_free1 (GST_QUERY_SLICE_SIZE (query), query);
+  g_slice_free1 (sizeof (GstQueryImpl), query);
 }
 
 static GstQuery *
@@ -223,14 +221,13 @@ _gst_query_copy (GstQuery * query)
 }
 
 static void
-gst_query_init (GstQueryImpl * query, gsize size, GstQueryType type)
+gst_query_init (GstQueryImpl * query, GstQueryType type)
 {
   gst_mini_object_init (GST_MINI_OBJECT_CAST (query), _gst_query_type);
 
   query->query.mini_object.copy = (GstMiniObjectCopyFunction) _gst_query_copy;
   query->query.mini_object.free = (GstMiniObjectFreeFunction) _gst_query_free;
 
-  GST_QUERY_SLICE_SIZE (query) = size;
   GST_QUERY_TYPE (query) = type;
 }
 
@@ -705,7 +702,7 @@ gst_query_new_custom (GstQueryType type, GstStructure * structure)
             &query->query.mini_object.refcount))
       goto had_parent;
   }
-  gst_query_init (query, sizeof (GstQueryImpl), type);
+  gst_query_init (query, type);
 
   GST_QUERY_STRUCTURE (query) = structure;
 
@@ -714,7 +711,7 @@ gst_query_new_custom (GstQueryType type, GstStructure * structure)
   /* ERRORS */
 had_parent:
   {
-    g_slice_free1 (GST_QUERY_SLICE_SIZE (query), query);
+    g_slice_free1 (sizeof (GstQueryImpl), query);
     g_warning ("structure is already owned by another object");
     return NULL;
   }