gsignal: Canonicalise signal names at installation time

Rather than adding a canonicalised and non-canonicalised version of the
signal to `g_signal_key_bsa`, just add the canonicalised version. Signal
lookups always use the canonicalised key (since the previous commit).

This saves space in `g_signal_key_bsa`, which should speed up lookups;
and it saves significant space in the global `GQuark` table (a 9.6%
reduction in entries in that table, by a rough test using
gnome-software).

We have to be a little more relaxed on the signal name validation than
we are for property name validation, as GTK installs a
`-gtk-private-changed` signal which violates the signal naming rules.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
This commit is contained in:
Philip Withnall
2019-11-12 19:42:44 +00:00
parent 875e2afa55
commit 89f955db2d
2 changed files with 51 additions and 21 deletions

View File

@@ -180,7 +180,8 @@ test_class_init (TestClass *klass)
NULL,
G_TYPE_NONE,
0);
simple2_id = g_signal_new ("simple-2",
/* Deliberately install this one in non-canonical form to check thats handled correctly: */
simple2_id = g_signal_new ("simple_2",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST | G_SIGNAL_NO_RECURSE,
0,