From 0dbb0f203e23524f323045eb55c5e8dc4f1c124c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Mon, 11 Oct 2010 19:27:54 +0100 Subject: [PATCH] miniobject: avoid duplicate type check when freeing miniobject gst_mini_object_unref() has guards that check the type already, so we don't really need to re-check it here again while getting the class (there's not really much point to that anyway, since we don't check the return value of the get_class, so we'd crash anyway if we're not dealing with a mini object, the only question would be if there'd be a warning before the crash or not). --- gst/gstminiobject.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gst/gstminiobject.c b/gst/gstminiobject.c index 2d128655ed..8d9d7f19b3 100644 --- a/gst/gstminiobject.c +++ b/gst/gstminiobject.c @@ -43,6 +43,9 @@ static GstAllocTrace *_gst_mini_object_trace; #endif +#define GST_MINI_OBJECT_GET_CLASS_UNCHECKED(obj) \ + ((GstMiniObjectClass *) (((GTypeInstance*)(obj))->g_class)) + #if 0 static void gst_mini_object_base_init (gpointer g_class); static void gst_mini_object_base_finalize (gpointer g_class); @@ -330,7 +333,7 @@ gst_mini_object_free (GstMiniObject * mini_object) g_atomic_int_inc (&mini_object->refcount); - mo_class = GST_MINI_OBJECT_GET_CLASS (mini_object); + mo_class = GST_MINI_OBJECT_GET_CLASS_UNCHECKED (mini_object); mo_class->finalize (mini_object); /* decrement the refcount again, if the subclass recycled the object we don't