summaryrefslogtreecommitdiff
path: root/gio
diff options
context:
space:
mode:
authorTimm Bäder <mail@baedert.org>2020-12-31 12:58:43 +0100
committerTimm Bäder <mail@baedert.org>2020-12-31 14:58:40 +0100
commit105e44beb573fb1513625d6edb3a740c2726a4ae (patch)
tree4fa463ce86d348311b30b3a68806a0e4844f90b9 /gio
parent89f12e10b682e099bb2186a40cc25908ff77a9a1 (diff)
downloadglib-105e44beb573fb1513625d6edb3a740c2726a4ae.tar.gz
gresource: Avoid work for NULL errors
Don't go through gettext if the GError** passed is NULL anyway.
Diffstat (limited to 'gio')
-rw-r--r--gio/gresource.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/gio/gresource.c b/gio/gresource.c
index b495d12ac..4c9652a94 100644
--- a/gio/gresource.c
+++ b/gio/gresource.c
@@ -929,9 +929,10 @@ g_resource_enumerate_children (GResource *resource,
if (*path == 0)
{
- g_set_error (error, G_RESOURCE_ERROR, G_RESOURCE_ERROR_NOT_FOUND,
- _("The resource at “%s” does not exist"),
- path);
+ if (error)
+ g_set_error (error, G_RESOURCE_ERROR, G_RESOURCE_ERROR_NOT_FOUND,
+ _("The resource at “%s” does not exist"),
+ path);
return NULL;
}
@@ -968,9 +969,10 @@ g_resource_enumerate_children (GResource *resource,
if (children == NULL)
{
- g_set_error (error, G_RESOURCE_ERROR, G_RESOURCE_ERROR_NOT_FOUND,
- _("The resource at “%s” does not exist"),
- path);
+ if (error)
+ g_set_error (error, G_RESOURCE_ERROR, G_RESOURCE_ERROR_NOT_FOUND,
+ _("The resource at “%s” does not exist"),
+ path);
return NULL;
}
@@ -1237,9 +1239,10 @@ g_resources_enumerate_children (const gchar *path,
if (hash == NULL)
{
- g_set_error (error, G_RESOURCE_ERROR, G_RESOURCE_ERROR_NOT_FOUND,
- _("The resource at “%s” does not exist"),
- path);
+ if (error)
+ g_set_error (error, G_RESOURCE_ERROR, G_RESOURCE_ERROR_NOT_FOUND,
+ _("The resource at “%s” does not exist"),
+ path);
return NULL;
}
else