mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-04-24 16:16:52 +02:00
GParamSpec: intern property names
Make it so that the ->name property on all GParamSpec objects is an interned string. https://bugzilla.gnome.org/show_bug.cgi?id=654627
This commit is contained in:
parent
7041b701dd
commit
d6c30e1766
@ -173,9 +173,6 @@ g_param_spec_finalize (GParamSpec *pspec)
|
|||||||
{
|
{
|
||||||
g_datalist_clear (&pspec->qdata);
|
g_datalist_clear (&pspec->qdata);
|
||||||
|
|
||||||
if (!(pspec->flags & G_PARAM_STATIC_NAME))
|
|
||||||
g_free (pspec->name);
|
|
||||||
|
|
||||||
if (!(pspec->flags & G_PARAM_STATIC_NICK))
|
if (!(pspec->flags & G_PARAM_STATIC_NICK))
|
||||||
g_free (pspec->_nick);
|
g_free (pspec->_nick);
|
||||||
|
|
||||||
@ -275,6 +272,9 @@ g_param_spec_ref_sink (GParamSpec *pspec)
|
|||||||
*
|
*
|
||||||
* Get the name of a #GParamSpec.
|
* Get the name of a #GParamSpec.
|
||||||
*
|
*
|
||||||
|
* The name is always an "interned" string (as per g_intern_string()).
|
||||||
|
* This allows for pointer-value comparisons.
|
||||||
|
*
|
||||||
* Returns: the name of @pspec.
|
* Returns: the name of @pspec.
|
||||||
*/
|
*/
|
||||||
const gchar *
|
const gchar *
|
||||||
@ -428,9 +428,15 @@ g_param_spec_internal (GType param_type,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pspec->name = g_strdup (name);
|
if (is_canonical (name))
|
||||||
canonicalize_key (pspec->name);
|
pspec->name = (gchar *) g_intern_string (name);
|
||||||
g_intern_string (pspec->name);
|
else
|
||||||
|
{
|
||||||
|
gchar *tmp = g_strdup (name);
|
||||||
|
canonicalize_key (tmp);
|
||||||
|
pspec->name = (gchar *) g_intern_string (tmp);
|
||||||
|
g_free (tmp);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flags & G_PARAM_STATIC_NICK)
|
if (flags & G_PARAM_STATIC_NICK)
|
||||||
|
@ -193,7 +193,7 @@ typedef struct _GParamSpecPool GParamSpecPool;
|
|||||||
/**
|
/**
|
||||||
* GParamSpec:
|
* GParamSpec:
|
||||||
* @g_type_instance: private #GTypeInstance portion
|
* @g_type_instance: private #GTypeInstance portion
|
||||||
* @name: name of this parameter
|
* @name: name of this parameter: always an interned string
|
||||||
* @flags: #GParamFlags flags for this parameter
|
* @flags: #GParamFlags flags for this parameter
|
||||||
* @value_type: the #GValue type for this parameter
|
* @value_type: the #GValue type for this parameter
|
||||||
* @owner_type: #GType type that uses (introduces) this parameter
|
* @owner_type: #GType type that uses (introduces) this parameter
|
||||||
|
Loading…
x
Reference in New Issue
Block a user