[glib/wip/baedert/gparam: 5/5] gresource: Avoid work for NULL errors
- From: Timm Bäder <baedert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib/wip/baedert/gparam: 5/5] gresource: Avoid work for NULL errors
- Date: Thu, 31 Dec 2020 12:22:51 +0000 (UTC)
commit ae267572e7681b9790d16d93d877f41e04167104
Author: Timm Bäder <mail baedert org>
Date: Thu Dec 31 12:58:43 2020 +0100
gresource: Avoid work for NULL errors
Don't go through gettext if the GError** passed is NULL anyway.
# Please enter the commit message for your changes. Lines starting
gio/gresource.c | 21 ++++++++++++---------
1 file 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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]