mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-18 22:36:33 +00:00
query: no need to store the size of the structure inside the structure
This commit is contained in:
parent
7eecd8f56f
commit
16e5684486
1 changed files with 4 additions and 7 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue