mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-20 15:48:54 +02:00
resourcefile: Avoid an allocation
Instead of enumerating the children only to throw them away, use the new g_resources_has_children() api.
This commit is contained in:
committed by
Philip Withnall
parent
a14241c895
commit
46fdbb43fa
@@ -455,21 +455,14 @@ g_resource_file_query_info (GFile *file,
|
|||||||
gboolean res;
|
gboolean res;
|
||||||
gsize size = 0;
|
gsize size = 0;
|
||||||
guint32 resource_flags = 0;
|
guint32 resource_flags = 0;
|
||||||
char **children;
|
|
||||||
gboolean is_dir;
|
gboolean is_dir;
|
||||||
char *base;
|
char *base;
|
||||||
|
|
||||||
is_dir = FALSE;
|
|
||||||
children = g_resources_enumerate_children (resource->path, 0, NULL);
|
|
||||||
if (children != NULL)
|
|
||||||
{
|
|
||||||
g_strfreev (children);
|
|
||||||
is_dir = TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* root is always there */
|
/* root is always there */
|
||||||
if (strcmp ("/", resource->path) == 0)
|
if (strcmp ("/", resource->path) == 0)
|
||||||
is_dir = TRUE;
|
is_dir = TRUE;
|
||||||
|
else
|
||||||
|
is_dir = g_resources_has_children (resource->path);
|
||||||
|
|
||||||
if (!is_dir)
|
if (!is_dir)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user