From 1ec8a341f8a90a4b68f7ee15335bf1c377d08a5d Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Sat, 19 Dec 2020 18:15:56 +0000 Subject: [PATCH] Port rpmostreed-transaction-livefs to C++ Prep for using https://cxx.rs/ --- Makefile-daemon.am | 2 +- ...-livefs.c => rpmostreed-transaction-livefs.cxx} | 14 +++++--------- 2 files changed, 6 insertions(+), 10 deletions(-) rename src/daemon/{rpmostreed-transaction-livefs.c => rpmostreed-transaction-livefs.cxx} (92%) diff --git a/Makefile-daemon.am b/Makefile-daemon.am index 1e8040e9..0f37330a 100644 --- a/Makefile-daemon.am +++ b/Makefile-daemon.am @@ -43,7 +43,7 @@ librpmostreed_sources = \ src/daemon/rpmostreed-transaction.cxx \ src/daemon/rpmostreed-transaction-types.h \ src/daemon/rpmostreed-transaction-types.cxx \ - src/daemon/rpmostreed-transaction-livefs.c \ + src/daemon/rpmostreed-transaction-livefs.cxx \ src/daemon/rpmostree-package-variants.h \ src/daemon/rpmostree-package-variants.c \ src/daemon/rpmostreed-os.h \ diff --git a/src/daemon/rpmostreed-transaction-livefs.c b/src/daemon/rpmostreed-transaction-livefs.cxx similarity index 92% rename from src/daemon/rpmostreed-transaction-livefs.c rename to src/daemon/rpmostreed-transaction-livefs.cxx index 94fb0562..ceecc757 100644 --- a/src/daemon/rpmostreed-transaction-livefs.c +++ b/src/daemon/rpmostreed-transaction-livefs.cxx @@ -86,14 +86,14 @@ livefs_transaction_execute (RpmostreedTransaction *transaction, } static void -livefs_transaction_class_init (LiveFsTransactionClass *class) +livefs_transaction_class_init (LiveFsTransactionClass *clazz) { GObjectClass *object_class; - object_class = G_OBJECT_CLASS (class); + object_class = G_OBJECT_CLASS (clazz); object_class->finalize = livefs_transaction_finalize; - class->execute = livefs_transaction_execute; + clazz->execute = livefs_transaction_execute; } static void @@ -108,21 +108,17 @@ rpmostreed_transaction_new_livefs (GDBusMethodInvocation *invocation, GCancellable *cancellable, GError **error) { - LiveFsTransaction *self; - g_return_val_if_fail (G_IS_DBUS_METHOD_INVOCATION (invocation), NULL); g_return_val_if_fail (OSTREE_IS_SYSROOT (sysroot), NULL); - self = g_initable_new (livefs_transaction_get_type (), + auto self = (LiveFsTransaction *)g_initable_new (livefs_transaction_get_type (), cancellable, error, "invocation", invocation, "sysroot-path", gs_file_get_path_cached (ostree_sysroot_get_path (sysroot)), NULL); if (self != NULL) - { - self->options = g_variant_ref (options); - } + self->options = g_variant_ref (options); return (RpmostreedTransaction *) self; }