mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-03-26 09:30:04 +01:00
gresource: Avoid a gettext lookup on a hot error path
See https://gitlab.gnome.org/GNOME/glib/-/merge_requests/4242#note_2215991 Signed-off-by: Philip Withnall <pwithnall@gnome.org> Helps: #3465
This commit is contained in:
parent
b2d8394f17
commit
26f2d54840
@ -679,9 +679,11 @@ static void
|
||||
set_error_not_found (GError **error,
|
||||
const char *path)
|
||||
{
|
||||
g_set_error (error, G_RESOURCE_ERROR, G_RESOURCE_ERROR_NOT_FOUND,
|
||||
_("The resource at “%s” does not exist"),
|
||||
path);
|
||||
/* Avoid looking up the translation if it’s not going to be used. This is a hot path. */
|
||||
if (error != NULL)
|
||||
g_set_error (error, G_RESOURCE_ERROR, G_RESOURCE_ERROR_NOT_FOUND,
|
||||
_("The resource at “%s” does not exist"),
|
||||
path);
|
||||
}
|
||||
|
||||
/* The only error this can return is %G_RESOURCE_ERROR_NOT_FOUND. */
|
||||
|
Loading…
x
Reference in New Issue
Block a user