mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-20 07:38:54 +02:00
registrybackend: avoid adding a new child when we return the root
This commit is contained in:
@@ -627,6 +627,13 @@ registry_cache_get_node_for_key (GNode *root,
|
|||||||
/* Ignore preceding / */
|
/* Ignore preceding / */
|
||||||
component = g_strdup (key_name);
|
component = g_strdup (key_name);
|
||||||
c = strchr (component, '/');
|
c = strchr (component, '/');
|
||||||
|
|
||||||
|
if (c == NULL)
|
||||||
|
{
|
||||||
|
g_free (component);
|
||||||
|
return root;
|
||||||
|
}
|
||||||
|
|
||||||
if (c != NULL)
|
if (c != NULL)
|
||||||
*c = 0;
|
*c = 0;
|
||||||
|
|
||||||
@@ -642,9 +649,7 @@ registry_cache_get_node_for_key (GNode *root,
|
|||||||
trace ("get_node_for_key: New node for component '%s'\n", component);
|
trace ("get_node_for_key: New node for component '%s'\n", component);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c == NULL)
|
if (*(c + 1) == 0)
|
||||||
result = root;
|
|
||||||
else if (*(c + 1) == 0)
|
|
||||||
result = child;
|
result = child;
|
||||||
else if (child != NULL)
|
else if (child != NULL)
|
||||||
result = registry_cache_get_node_for_key_recursive (child, c + 1,
|
result = registry_cache_get_node_for_key_recursive (child, c + 1,
|
||||||
|
Reference in New Issue
Block a user