mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-25 17:50:36 +00:00
uri: Add gst_clear_uri()
Basically, you can use this instead of using `gst_uri_unref()` (which needs to be preceded by a NULL-check). See https://gitlab.freedesktop.org/gstreamer/gstreamer/issues/275 and https://gitlab.freedesktop.org/gstreamer/gstreamer/merge_requests/3
This commit is contained in:
parent
19467a7d8d
commit
8d180557eb
1 changed files with 19 additions and 0 deletions
19
gst/gsturi.h
19
gst/gsturi.h
|
@ -392,6 +392,25 @@ gst_uri_unref (GstUri * uri)
|
|||
gst_mini_object_unref (GST_MINI_OBJECT_CAST (uri));
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_clear_uri: (skip)
|
||||
* @uri_ptr: a pointer to a #GstUri reference
|
||||
*
|
||||
* Clears a reference to a #GstUri.
|
||||
*
|
||||
* @uri_ptr must not be %NULL.
|
||||
*
|
||||
* If the reference is %NULL then this function does nothing. Otherwise, the
|
||||
* reference count of the uri is decreased and the pointer is set to %NULL.
|
||||
*
|
||||
* Since: 1.18
|
||||
*/
|
||||
static inline void
|
||||
gst_clear_uri (GstUri ** uri_ptr)
|
||||
{
|
||||
gst_clear_mini_object ((GstMiniObject **) uri_ptr);
|
||||
}
|
||||
|
||||
#ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstUri, gst_uri_unref)
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue