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:
Matthias Clasen 2024-09-06 00:18:05 -04:00 committed by Philip Withnall
parent a14241c895
commit 46fdbb43fa

View File

@ -455,21 +455,14 @@ g_resource_file_query_info (GFile *file,
gboolean res;
gsize size = 0;
guint32 resource_flags = 0;
char **children;
gboolean is_dir;
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 */
if (strcmp ("/", resource->path) == 0)
is_dir = TRUE;
else
is_dir = g_resources_has_children (resource->path);
if (!is_dir)
{