[glib/gobject-speedups: 17/28] Simplify g_object_notify_by_pspec
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib/gobject-speedups: 17/28] Simplify g_object_notify_by_pspec
- Date: Mon, 23 May 2022 17:30:22 +0000 (UTC)
commit eaeb43b9781b5c6fc5fe5e8532a71b9a1ad9783d
Author: Matthias Clasen <mclasen redhat com>
Date: Sat May 21 07:28:03 2022 -0400
Simplify g_object_notify_by_pspec
gobject/gobject.c | 33 +++++++++------------------------
1 file changed, 9 insertions(+), 24 deletions(-)
---
diff --git a/gobject/gobject.c b/gobject/gobject.c
index b4b818b083..638097a6d1 100644
--- a/gobject/gobject.c
+++ b/gobject/gobject.c
@@ -1307,33 +1307,18 @@ g_object_freeze_notify (GObject *object)
g_object_unref (object);
}
-static GParamSpec *
-get_notify_pspec (GParamSpec *pspec)
-{
- GParamSpec *redirected;
-
- /* we don't notify on non-READABLE parameters */
- if (~pspec->flags & G_PARAM_READABLE)
- return NULL;
-
- /* if the paramspec is redirected, notify on the target */
- redirected = g_param_spec_get_redirect_target (pspec);
- if (redirected != NULL)
- return redirected;
-
- /* else, notify normally */
- return pspec;
-}
-
static inline void
g_object_notify_by_spec_internal (GObject *object,
- GParamSpec *pspec)
+ GParamSpec *pspec)
{
- GParamSpec *notify_pspec;
+ if (G_UNLIKELY (~pspec->flags & G_PARAM_READABLE))
+ return;
- notify_pspec = get_notify_pspec (pspec);
+ redirected = g_param_spec_get_redirect_target (pspec);
+ if (redirected != NULL)
+ pspec = redirected;
- if (notify_pspec != NULL)
+ if (pspec != NULL)
{
GObjectNotifyQueue *nqueue;
@@ -1343,13 +1328,13 @@ g_object_notify_by_spec_internal (GObject *object,
if (nqueue != NULL)
{
/* we're frozen, so add to the queue and release our freeze */
- g_object_notify_queue_add (object, nqueue, notify_pspec);
+ g_object_notify_queue_add (object, nqueue, pspec);
g_object_notify_queue_thaw (object, nqueue);
}
else
/* not frozen, so just dispatch the notification directly */
G_OBJECT_GET_CLASS (object)
- ->dispatch_properties_changed (object, 1, ¬ify_pspec);
+ ->dispatch_properties_changed (object, 1, &pspec);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]