summaryrefslogtreecommitdiff
path: root/registryd
diff options
context:
space:
mode:
authorFederico Mena Quintero <federico@gnome.org>2022-07-11 17:48:25 -0500
committerFederico Mena Quintero <federico@gnome.org>2022-07-12 21:46:29 -0500
commitcd31800c9380a08925bbd0beffa97a799525c2ba (patch)
tree4d42c71fea9ee3a9057b1751bbca9a5df2741359 /registryd
parent69734298c5ce78dc29f0cec9dfab6cd5af1056e2 (diff)
downloadat-spi2-core-cd31800c9380a08925bbd0beffa97a799525c2ba.tar.gz
impl_Embed: extract function with the actual logic of the method
Diffstat (limited to 'registryd')
-rw-r--r--registryd/registry.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/registryd/registry.c b/registryd/registry.c
index 2d252c33..5e08f6e4 100644
--- a/registryd/registry.c
+++ b/registryd/registry.c
@@ -435,10 +435,19 @@ socket_embed_demarshal (DBusMessage *message, SpiReference **out_app_root)
return DEMARSHAL_STATUS_SUCCESS;
}
+static SpiReference *
+socket_embed (SpiRegistry *registry, SpiReference *app_root)
+{
+ add_application (registry, app_root);
+ set_id (registry, app_root);
+ return spi_reference_new (registry->bus_unique_name, SPI_DBUS_PATH_ROOT);
+}
+
static DBusMessage*
impl_Embed (DBusMessage *message, SpiRegistry *registry)
{
SpiReference *app_root = NULL;
+ SpiReference *result;
if (socket_embed_demarshal (message, &app_root) != DEMARSHAL_STATUS_SUCCESS)
{
@@ -448,14 +457,12 @@ impl_Embed (DBusMessage *message, SpiRegistry *registry)
DBusMessage *reply = NULL;
DBusMessageIter reply_iter;
- add_application (registry, app_root);
- set_id (registry, app_root);
+ result = socket_embed (registry, app_root); /* takes ownership of the app_root */
reply = dbus_message_new_method_return (message);
dbus_message_iter_init_append (reply, &reply_iter);
- append_reference (&reply_iter,
- registry->bus_unique_name,
- SPI_DBUS_PATH_ROOT);
+ append_reference (&reply_iter, result->name, result->path);
+ spi_reference_free (result);
return reply;
}