[file-roller/wip/jtojnar/engrampa-backports: 19/24] test-server: Remove unreachable code after calling g_error
- From: Jan Tojnar <jtojnar src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [file-roller/wip/jtojnar/engrampa-backports: 19/24] test-server: Remove unreachable code after calling g_error
- Date: Wed, 27 Jul 2022 19:54:33 +0000 (UTC)
commit 1a169a9c66ca0d39a2c1fc1480077a3af80b0907
Author: Jan Tojnar <jtojnar gmail com>
Date: Tue Oct 26 21:47:13 2021 +0200
test-server: Remove unreachable code after calling g_error
Instead, use automatic memory management.
Inspired by https://github.com/mate-desktop/engrampa/commit/04c38d80626d706e1c40ea53befb5372c85f289c
src/fr-application.c | 3 +--
src/test-server.c | 9 +++------
2 files changed, 4 insertions(+), 8 deletions(-)
---
diff --git a/src/fr-application.c b/src/fr-application.c
index 8649b9a5..708684ba 100644
--- a/src/fr-application.c
+++ b/src/fr-application.c
@@ -399,7 +399,7 @@ on_bus_acquired_for_archive_manager (GDBusConnection *connection,
{
FrApplication *self = user_data;
guint registration_id;
- GError *error = NULL;
+ g_autoptr (GError) error = NULL;
registration_id = g_dbus_connection_register_object (connection,
"/org/gnome/ArchiveManager1",
@@ -410,7 +410,6 @@ on_bus_acquired_for_archive_manager (GDBusConnection *connection,
&error); /* GError** */
if (registration_id == 0) {
g_error ("%s", error->message);
- g_clear_error (&error);
}
}
diff --git a/src/test-server.c b/src/test-server.c
index 2992575d..716c6668 100644
--- a/src/test-server.c
+++ b/src/test-server.c
@@ -39,13 +39,12 @@ fileroller_getsupportedtypes_ready_cb (GObject *source_object,
{
GDBusProxy *proxy;
GVariant *values;
- GError *error = NULL;
+ g_autoptr (GError) error = NULL;
proxy = G_DBUS_PROXY (source_object);
values = g_dbus_proxy_call_finish (proxy, res, &error);
if (values == NULL) {
g_error ("%s\n", error->message);
- g_clear_error (&error);
}
else {
GVariantIter argument_iter;
@@ -99,13 +98,12 @@ fileroller_addtoarchive_ready_cb (GObject *source_object,
{
GDBusProxy *proxy;
GVariant *values;
- GError *error = NULL;
+ g_autoptr (GError) error = NULL;
proxy = G_DBUS_PROXY (source_object);
values = g_dbus_proxy_call_finish (proxy, res, &error);
if (values == NULL) {
g_error ("%s\n", error->message);
- g_clear_error (&error);
}
if (values != NULL)
@@ -139,7 +137,7 @@ int
main (int argc, char *argv[])
{
GDBusConnection *connection;
- GError *error = NULL;
+ g_autoptr (GError) error = NULL;
connection = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &error);
if (connection != NULL) {
@@ -268,7 +266,6 @@ main (int argc, char *argv[])
}
else {
g_error ("%s\n", error->message);
- g_clear_error (&error);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]