From 067db77499ebb39462e33ace981a495b9941489f Mon Sep 17 00:00:00 2001 From: Edward Hervey Date: Tue, 21 Mar 2006 13:50:52 +0000 Subject: [PATCH] gst/: gst_[buffer|event|message]_ref() macros are replaced by a static inline functions because gcc-4.1 will about if... Original commit message from CVS: * gst/gstbuffer.h: * gst/gstevent.h: * gst/gstmessage.h: gst_[buffer|event|message]_ref() macros are replaced by a static inline functions because gcc-4.1 will about if the return value isn't used. * tests/check/gst/gstevent.c: (event_probe): gst_event_ref now has to be given a GstEvent* , fix check accordingly. --- ChangeLog | 11 +++++++++++ gst/gstbuffer.h | 9 ++++++++- gst/gstevent.h | 9 ++++++++- gst/gstmessage.h | 9 ++++++++- tests/check/gst/gstevent.c | 4 ++-- 5 files changed, 37 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0de88cf..07e759b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2006-03-21 Edward Hervey + + * gst/gstbuffer.h: + * gst/gstevent.h: + * gst/gstmessage.h: + gst_[buffer|event|message]_ref() macros are replaced by a static + inline functions because gcc-4.1 will about if the return value + isn't used. + * tests/check/gst/gstevent.c: (event_probe): + gst_event_ref now has to be given a GstEvent* , fix check accordingly. + 2006-03-20 Jan Schmidt * gst/gstutils.h: diff --git a/gst/gstbuffer.h b/gst/gstbuffer.h index 904b8e9..6213c23 100644 --- a/gst/gstbuffer.h +++ b/gst/gstbuffer.h @@ -287,7 +287,14 @@ G_STMT_START { \ * * Increases the refcount of the given buffer by one. */ -#define gst_buffer_ref(buf) GST_BUFFER_CAST (gst_mini_object_ref (GST_MINI_OBJECT (buf))) +static inline GstBuffer * +gst_buffer_ref (GstBuffer * buf) +{ + /* not using a macro here because gcc-4.1 will complain + * if the return value isn't used (because of the cast) */ + return (GstBuffer *) gst_mini_object_ref (GST_MINI_OBJECT (buf)); +} + /** * gst_buffer_unref: * @buf: a #GstBuffer. diff --git a/gst/gstevent.h b/gst/gstevent.h index e12ab336..d7f7343 100644 --- a/gst/gstevent.h +++ b/gst/gstevent.h @@ -325,7 +325,14 @@ GType gst_event_get_type (void); * * Increase the refcount of this event. */ -#define gst_event_ref(ev) GST_EVENT (gst_mini_object_ref (GST_MINI_OBJECT (ev))) +static inline GstEvent * +gst_event_ref (GstEvent * ev) +{ + /* not using a macro here because gcc-4.1 will complain + * if the return value isn't used (because of the cast) */ + return (GstEvent *) gst_mini_object_ref (GST_MINI_OBJECT (ev)); +} + /** * gst_event_unref: * @ev: The event to refcount diff --git a/gst/gstmessage.h b/gst/gstmessage.h index 4e633ef..e2653cf 100644 --- a/gst/gstmessage.h +++ b/gst/gstmessage.h @@ -199,7 +199,14 @@ GQuark gst_message_type_to_quark (GstMessageType type); * Convenience macro to increase the reference count of the message. Returns the * reffed message. */ -#define gst_message_ref(msg) GST_MESSAGE (gst_mini_object_ref (GST_MINI_OBJECT (msg))) +static inline GstMessage * +gst_message_ref (GstMessage * msg) +{ + /* not using a macro here because gcc-4.1 will complain + * if the return value isn't used (because of the cast) */ + return (GstMessage *) gst_mini_object_ref (GST_MINI_OBJECT (msg)); +} + /** * gst_message_unref: * @msg: the message to unref diff --git a/tests/check/gst/gstevent.c b/tests/check/gst/gstevent.c index 6cc792c..a290f9b 100644 --- a/tests/check/gst/gstevent.c +++ b/tests/check/gst/gstevent.c @@ -208,7 +208,7 @@ event_probe (GstPad * pad, GstMiniObject ** data, gpointer user_data) case GST_EVENT_CUSTOM_BOTH_OOB: if (got_event_before_q != NULL) break; - gst_event_ref (data); + gst_event_ref ((GstEvent *) data); g_get_current_time (&got_event_time); got_event_before_q = GST_EVENT (data); break; @@ -223,7 +223,7 @@ event_probe (GstPad * pad, GstMiniObject ** data, gpointer user_data) case GST_EVENT_CUSTOM_BOTH_OOB: if (got_event_after_q != NULL) break; - gst_event_ref (data); + gst_event_ref ((GstEvent *) data); g_get_current_time (&got_event_time); got_event_after_q = GST_EVENT (data); break; -- 2.7.4