From 63319afe365bd517572b73429e3be851001387a8 Mon Sep 17 00:00:00 2001 From: Sebastian Wick Date: Fri, 1 Nov 2024 20:54:46 +0100 Subject: [PATCH] Always initialize g_auto(GVariantBuilder) --- src/email.c | 5 ++--- src/global-shortcuts.c | 13 ++++++------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/email.c b/src/email.c index 86be9f442..890b69ea1 100644 --- a/src/email.c +++ b/src/email.c @@ -213,13 +213,12 @@ handle_compose_email (XdpDbusEmail *object, const char *app_id = xdp_app_info_get_id (request->app_info); g_autoptr(GError) error = NULL; g_autoptr(XdpDbusImplRequest) impl_request = NULL; - g_auto(GVariantBuilder) options; + g_auto(GVariantBuilder) options = + G_VARIANT_BUILDER_INIT (G_VARIANT_TYPE_VARDICT); g_autoptr(GVariant) attachment_fds = NULL; g_debug ("Handling ComposeEmail"); - g_variant_builder_init (&options, G_VARIANT_TYPE_VARDICT); - REQUEST_AUTOLOCK (request); impl_request = xdp_dbus_impl_request_proxy_new_sync (g_dbus_proxy_get_connection (G_DBUS_PROXY (impl)), diff --git a/src/global-shortcuts.c b/src/global-shortcuts.c index 11712533d..5fc4afbe5 100644 --- a/src/global-shortcuts.c +++ b/src/global-shortcuts.c @@ -233,13 +233,13 @@ handle_create_session (XdpDbusGlobalShortcuts *object, Request *request = request_from_invocation (invocation); g_autoptr(GError) error = NULL; g_autoptr(XdpDbusImplRequest) impl_request = NULL; - g_auto(GVariantBuilder) options_builder; + g_auto(GVariantBuilder) options_builder = + G_VARIANT_BUILDER_INIT (G_VARIANT_TYPE_VARDICT); g_autoptr(GVariant) options = NULL; Session *session; REQUEST_AUTOLOCK (request); - g_variant_builder_init (&options_builder, G_VARIANT_TYPE_VARDICT); if (!xdp_filter_options (arg_options, &options_builder, global_shortcuts_create_session_options, G_N_ELEMENTS (global_shortcuts_create_session_options), @@ -388,14 +388,13 @@ handle_bind_shortcuts (XdpDbusGlobalShortcuts *object, g_autoptr(GError) error = NULL; g_autoptr(GVariant) options = NULL; g_autoptr(GVariant) shortcuts = NULL; - g_auto(GVariantBuilder) shortcuts_builder; - g_auto(GVariantBuilder) options_builder; + g_auto(GVariantBuilder) shortcuts_builder = + G_VARIANT_BUILDER_INIT (G_VARIANT_TYPE_ARRAY); + g_auto(GVariantBuilder) options_builder = + G_VARIANT_BUILDER_INIT (G_VARIANT_TYPE_VARDICT); REQUEST_AUTOLOCK (request); - g_variant_builder_init (&shortcuts_builder, G_VARIANT_TYPE_ARRAY); - g_variant_builder_init (&options_builder, G_VARIANT_TYPE_VARDICT); - if (!xdp_filter_options (arg_options, &options_builder, global_shortcuts_bind_shortcuts_options, G_N_ELEMENTS (global_shortcuts_bind_shortcuts_options),