mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-20 13:06:23 +00:00
gstvalue: Minor optimization for checks
For value types that aren't subclassable, just check the type directly. For flags, compare against the fundamental type directly instead of going through the more expensive recursive check of `G_TYPE_CHECK_VALUE_TYPE()` Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/453>
This commit is contained in:
parent
dc7efe296d
commit
f800559789
2 changed files with 4 additions and 4 deletions
|
@ -5776,7 +5776,7 @@ gst_value_list_equals_range (const GValue * list, const GValue * value)
|
|||
/* compare the basic types - they have to match */
|
||||
first = VALUE_LIST_GET_VALUE (list, 0);
|
||||
#define CHECK_TYPES(type,prefix) \
|
||||
(prefix##_VALUE_HOLDS_##type(first) && GST_VALUE_HOLDS_##type##_RANGE (value))
|
||||
((first) && G_VALUE_TYPE(first) == prefix##_TYPE_##type && GST_VALUE_HOLDS_##type##_RANGE (value))
|
||||
if (CHECK_TYPES (INT, G)) {
|
||||
const gint rmin = gst_value_get_int_range_min (value);
|
||||
const gint rmax = gst_value_get_int_range_max (value);
|
||||
|
|
|
@ -151,7 +151,7 @@ G_BEGIN_DECLS
|
|||
*
|
||||
* Checks if the given #GValue contains a #GST_TYPE_STRUCTURE value.
|
||||
*/
|
||||
#define GST_VALUE_HOLDS_STRUCTURE(x) (G_VALUE_HOLDS((x), _gst_structure_type))
|
||||
#define GST_VALUE_HOLDS_STRUCTURE(x) ((x) != NULL && G_VALUE_TYPE(x) == _gst_structure_type)
|
||||
|
||||
/**
|
||||
* GST_VALUE_HOLDS_CAPS_FEATURES:
|
||||
|
@ -159,7 +159,7 @@ G_BEGIN_DECLS
|
|||
*
|
||||
* Checks if the given #GValue contains a #GST_TYPE_CAPS_FEATURES value.
|
||||
*/
|
||||
#define GST_VALUE_HOLDS_CAPS_FEATURES(x) (G_VALUE_HOLDS((x), _gst_caps_features_type))
|
||||
#define GST_VALUE_HOLDS_CAPS_FEATURES(x) ((x) != NULL && G_VALUE_TYPE(x) == _gst_caps_features_type)
|
||||
|
||||
/**
|
||||
* GST_VALUE_HOLDS_BUFFER:
|
||||
|
@ -209,7 +209,7 @@ G_BEGIN_DECLS
|
|||
*
|
||||
* Since: 1.6
|
||||
*/
|
||||
#define GST_VALUE_HOLDS_FLAG_SET(x) (G_TYPE_CHECK_VALUE_TYPE ((x), GST_TYPE_FLAG_SET))
|
||||
#define GST_VALUE_HOLDS_FLAG_SET(x) (G_TYPE_FUNDAMENTAL (G_VALUE_TYPE ((x))) == GST_TYPE_FLAG_SET)
|
||||
|
||||
/**
|
||||
* GST_FLAG_SET_MASK_EXACT: (value 4294967295) (type guint)
|
||||
|
|
Loading…
Reference in a new issue