Port rpmostree-db-builtin-dif to C++

Prep for using https://cxx.rs/
This commit is contained in:
Colin Walters 2020-12-21 16:08:51 +00:00 committed by OpenShift Merge Robot
parent e58316ec94
commit 63b5ccb1b1
2 changed files with 6 additions and 3 deletions

View File

@ -44,7 +44,7 @@ rpm_ostree_SOURCES = src/app/main.cxx \
src/app/rpmostree-builtin-db.cxx \ src/app/rpmostree-builtin-db.cxx \
src/app/rpmostree-builtin-start-daemon.cxx \ src/app/rpmostree-builtin-start-daemon.cxx \
src/app/rpmostree-builtin-finalize-deployment.cxx \ src/app/rpmostree-builtin-finalize-deployment.cxx \
src/app/rpmostree-db-builtin-diff.c \ src/app/rpmostree-db-builtin-diff.cxx \
src/app/rpmostree-db-builtin-list.c \ src/app/rpmostree-db-builtin-list.c \
src/app/rpmostree-db-builtin-version.c \ src/app/rpmostree-db-builtin-version.c \
src/app/rpmostree-dbus-helpers.cxx \ src/app/rpmostree-dbus-helpers.cxx \

View File

@ -30,7 +30,7 @@
#include "rpmostree-rpm-util.h" #include "rpmostree-rpm-util.h"
#include "rpmostree-package-variants.h" #include "rpmostree-package-variants.h"
static char *opt_format = "block"; static char *opt_format;
static gboolean opt_changelogs; static gboolean opt_changelogs;
static char *opt_sysroot; static char *opt_sysroot;
static gboolean opt_base; static gboolean opt_base;
@ -117,7 +117,7 @@ get_checksum_from_deployment (OstreeRepo *repo,
if (!checksum) if (!checksum)
checksum = g_strdup (ostree_deployment_get_csum (deployment)); checksum = g_strdup (ostree_deployment_get_csum (deployment));
*out_checksum = g_steal_pointer (&checksum); *out_checksum = util::move_nullify (checksum);
return TRUE; return TRUE;
} }
@ -162,6 +162,9 @@ rpmostree_db_builtin_diff (int argc, char **argv,
return FALSE; return FALSE;
} }
if (!opt_format)
opt_format = g_strdup ("block");
if (g_str_equal (opt_format, "json") && opt_changelogs) if (g_str_equal (opt_format, "json") && opt_changelogs)
{ {
rpmostree_usage_error (context, "json format and --changelogs not supported", error); rpmostree_usage_error (context, "json format and --changelogs not supported", error);