summaryrefslogtreecommitdiff
path: root/installed-tests/js
diff options
context:
space:
mode:
authorMarco Trevisan (Treviño) <mail@3v1n0.net>2021-04-07 19:38:38 +0200
committerMarco Trevisan (Treviño) <mail@3v1n0.net>2021-04-22 22:58:57 +0200
commit08bf63bfea524e9a4a3ccc4656e1d161336a38eb (patch)
tree954b091e5b9bde93cedf257547bf1c2d32ecd372 /installed-tests/js
parent57083717017c850a8a634d9753c20b5b3fae63cb (diff)
downloadgjs-08bf63bfea524e9a4a3ccc4656e1d161336a38eb.tar.gz
gjs-test-tools: Use `g_prefix_error` instead of using that ourself
Diffstat (limited to 'installed-tests/js')
-rw-r--r--installed-tests/js/libgjstesttools/gjs-test-tools.cpp23
1 files changed, 2 insertions, 21 deletions
diff --git a/installed-tests/js/libgjstesttools/gjs-test-tools.cpp b/installed-tests/js/libgjstesttools/gjs-test-tools.cpp
index c018cc2e..54c457bc 100644
--- a/installed-tests/js/libgjstesttools/gjs-test-tools.cpp
+++ b/installed-tests/js/libgjstesttools/gjs-test-tools.cpp
@@ -244,31 +244,12 @@ GObject* gjs_test_tools_get_disposed(GObject* object) {
#ifdef G_OS_UNIX
// Adapted from glnx_throw_errno_prefix()
-G_GNUC_PRINTF(2, 3)
-static gboolean throw_errno_prefix(GError** error, const char* fmt, ...) {
+static gboolean throw_errno_prefix(GError** error, const char* prefix) {
int errsv = errno;
- char* old_msg;
- GString* buf;
-
- va_list args;
-
- if (!error)
- return FALSE;
-
- va_start(args, fmt);
g_set_error_literal(error, G_IO_ERROR, g_io_error_from_errno(errsv),
g_strerror(errsv));
-
- old_msg = g_steal_pointer(&(*error)->message);
- buf = g_string_new("");
- g_string_append_vprintf(buf, fmt, args);
- g_string_append(buf, ": ");
- g_string_append(buf, old_msg);
- g_free(old_msg);
- (*error)->message = g_string_free(g_steal_pointer(&buf), FALSE);
-
- va_end(args);
+ g_prefix_error(error, "%s: ", prefix);
errno = errsv;
return FALSE;