mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-26 07:26:15 +01:00
Make the name field const. (g_signal_newv): Don't keep an unnecessary
2005-09-05 Matthias Clasen <mclasen@redhat.com> * gsignal.c (struct _SignalNode): Make the name field const. (g_signal_newv): Don't keep an unnecessary extra copy of the signal name around, and don't forget to free the name if an existing node is reused.
This commit is contained in:
parent
38094ffb5c
commit
8161643a39
@ -1,3 +1,10 @@
|
|||||||
|
2005-09-05 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
|
* gsignal.c (struct _SignalNode): Make the name field const.
|
||||||
|
(g_signal_newv): Don't keep an unnecessary extra copy of the
|
||||||
|
signal name around, and don't forget to free the name if
|
||||||
|
an existing node is reused.
|
||||||
|
|
||||||
2005-08-31 Matthias Clasen <mclasen@redhat.com>
|
2005-08-31 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
* gobject.c (g_object_do_class_init): Intern the signal name.
|
* gobject.c (g_object_do_class_init): Intern the signal name.
|
||||||
|
@ -175,7 +175,7 @@ struct _SignalNode
|
|||||||
/* permanent portion */
|
/* permanent portion */
|
||||||
guint signal_id;
|
guint signal_id;
|
||||||
GType itype;
|
GType itype;
|
||||||
gchar *name;
|
const gchar *name;
|
||||||
guint destroyed : 1;
|
guint destroyed : 1;
|
||||||
|
|
||||||
/* reinitializable portion */
|
/* reinitializable portion */
|
||||||
@ -1123,14 +1123,14 @@ G_CONST_RETURN gchar*
|
|||||||
g_signal_name (guint signal_id)
|
g_signal_name (guint signal_id)
|
||||||
{
|
{
|
||||||
SignalNode *node;
|
SignalNode *node;
|
||||||
gchar *name;
|
const gchar *name;
|
||||||
|
|
||||||
SIGNAL_LOCK ();
|
SIGNAL_LOCK ();
|
||||||
node = LOOKUP_SIGNAL_NODE (signal_id);
|
node = LOOKUP_SIGNAL_NODE (signal_id);
|
||||||
name = node ? node->name : NULL;
|
name = node ? node->name : NULL;
|
||||||
SIGNAL_UNLOCK ();
|
SIGNAL_UNLOCK ();
|
||||||
|
|
||||||
return name;
|
return (char*) name;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -1356,8 +1356,9 @@ g_signal_newv (const gchar *signal_name,
|
|||||||
key.quark = g_quark_from_string (node->name);
|
key.quark = g_quark_from_string (node->name);
|
||||||
key.signal_id = signal_id;
|
key.signal_id = signal_id;
|
||||||
g_signal_key_bsa = g_bsearch_array_insert (g_signal_key_bsa, &g_signal_key_bconfig, &key);
|
g_signal_key_bsa = g_bsearch_array_insert (g_signal_key_bsa, &g_signal_key_bconfig, &key);
|
||||||
g_strdelimit (node->name, "_", '-');
|
g_strdelimit (name, "_", '-');
|
||||||
key.quark = g_quark_from_static_string (node->name);
|
node->name = g_intern_string (name);
|
||||||
|
key.quark = g_quark_from_string (name);
|
||||||
g_signal_key_bsa = g_bsearch_array_insert (g_signal_key_bsa, &g_signal_key_bconfig, &key);
|
g_signal_key_bsa = g_bsearch_array_insert (g_signal_key_bsa, &g_signal_key_bconfig, &key);
|
||||||
}
|
}
|
||||||
node->destroyed = FALSE;
|
node->destroyed = FALSE;
|
||||||
@ -1388,6 +1389,8 @@ g_signal_newv (const gchar *signal_name,
|
|||||||
}
|
}
|
||||||
SIGNAL_UNLOCK ();
|
SIGNAL_UNLOCK ();
|
||||||
|
|
||||||
|
g_free (name);
|
||||||
|
|
||||||
return signal_id;
|
return signal_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user