[glib/halfline/debug-metrics: 4/9] gsignal: add g_signal_name_unlocked helper
- From: Ray Strode <halfline src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib/halfline/debug-metrics: 4/9] gsignal: add g_signal_name_unlocked helper
- Date: Tue, 13 Jul 2021 04:35:41 +0000 (UTC)
commit 4396678fef5f302243a1a6cdd1503ea22ef0ac79
Author: Ray Strode <rstrode redhat com>
Date: Wed May 26 23:45:04 2021 -0400
gsignal: add g_signal_name_unlocked helper
This function fetches the name of a signal from its id.
It's like g_signal_name, but works when the signal lock is held.
gobject/gsignal.c | 21 ++++++++++++++++-----
1 file changed, 16 insertions(+), 5 deletions(-)
---
diff --git a/gobject/gsignal.c b/gobject/gsignal.c
index fa7d9b274..1c5f5ee87 100644
--- a/gobject/gsignal.c
+++ b/gobject/gsignal.c
@@ -204,6 +204,7 @@ static void invalid_closure_notify (gpointer data,
static const gchar * type_debug_name (GType type);
static void node_check_deprecated (const SignalNode *node);
static void node_update_single_va_closure (SignalNode *node);
+static const gchar *g_signal_name_unlocked (guint signal_id);
/* --- structures --- */
@@ -1314,6 +1315,18 @@ g_signal_list_ids (GType itype,
return (guint*) g_array_free (result, FALSE);
}
+static const gchar *
+g_signal_name_unlocked (guint signal_id)
+{
+ SignalNode *node;
+ const gchar *name;
+
+ node = LOOKUP_SIGNAL_NODE (signal_id);
+ name = node ? node->name : NULL;
+
+ return (char*) name;
+}
+
/**
* g_signal_name:
* @signal_id: the signal's identifying number.
@@ -1327,14 +1340,12 @@ g_signal_list_ids (GType itype,
const gchar *
g_signal_name (guint signal_id)
{
- SignalNode *node;
const gchar *name;
-
+
SIGNAL_LOCK ();
- node = LOOKUP_SIGNAL_NODE (signal_id);
- name = node ? node->name : NULL;
+ name = g_signal_name_unlocked (signal_id);
SIGNAL_UNLOCK ();
-
+
return (char*) name;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]