[glib/gobject-speedups: 97/103] Avoid g_value_type_compatible
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib/gobject-speedups: 97/103] Avoid g_value_type_compatible
- Date: Fri, 20 May 2022 02:03:07 +0000 (UTC)
commit 9f1fee7d1b6ffa42aaf998f4afd3da99dd817f61
Author: Matthias Clasen <mclasen redhat com>
Date: Thu May 19 18:25:50 2022 -0400
Avoid g_value_type_compatible
99% of the time, we deal with a value that was
just collected with the exact pspec type, so this
check will avoid g_value_type_compatible.
gobject/gobject.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
---
diff --git a/gobject/gobject.c b/gobject/gobject.c
index f54afcdfaa..bed3a19623 100644
--- a/gobject/gobject.c
+++ b/gobject/gobject.c
@@ -1619,7 +1619,8 @@ object_set_property (GObject *object,
consider_issuing_property_deprecation_warning (pspec);
pclass = G_PARAM_SPEC_GET_CLASS (pspec);
- if (g_value_type_compatible (G_VALUE_TYPE (value), pspec->value_type) &&
+ if ((G_VALUE_TYPE (value) == pspec->value_type ||
+ g_value_type_compatible (G_VALUE_TYPE (value), pspec->value_type)) &&
(pclass->value_validate == NULL ||
(pclass->value_is_valid != NULL && pclass->value_is_valid (pspec, value))))
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]