diff options
author | Colin Walters <walters@verbum.org> | 2023-05-03 08:24:21 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-03 08:24:21 -0400 |
commit | 8a2993a9d01cc358e4c2d936ca132174aabdc714 (patch) | |
tree | 5402001ab710dadfd51ba3e9071b044016030e3e /tests/repo-finder-mount.c | |
parent | dd70c9b78cc34ccc7e638eda4c2df1ddd8ee3add (diff) | |
parent | c1044a02b28982ef6dd58af98b23a40482d26487 (diff) | |
download | ostree-8a2993a9d01cc358e4c2d936ca132174aabdc714.tar.gz |
Merge pull request #2565 from cgwalters/clang-format
Add .clang-format file + tree-wide: Run `clang-format`
Diffstat (limited to 'tests/repo-finder-mount.c')
-rw-r--r-- | tests/repo-finder-mount.c | 50 |
1 files changed, 24 insertions, 26 deletions
diff --git a/tests/repo-finder-mount.c b/tests/repo-finder-mount.c index 66c4ecd7..68a0e3de 100644 --- a/tests/repo-finder-mount.c +++ b/tests/repo-finder-mount.c @@ -24,22 +24,20 @@ #include "config.h" #include <gio/gio.h> -#include <glib.h> #include <glib-object.h> +#include <glib.h> #include <libglnx.h> #include <locale.h> #include "ostree-autocleanups.h" #include "ostree-remote-private.h" -#include "ostree-repo-finder.h" #include "ostree-repo-finder-mount.h" +#include "ostree-repo-finder.h" #include "ostree-types.h" #include "test-mock-gio.h" static void -result_cb (GObject *source_object, - GAsyncResult *result, - gpointer user_data) +result_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) { GAsyncResult **result_out = user_data; *result_out = g_object_ref (result); @@ -54,33 +52,35 @@ collection_ref_free0 (OstreeCollectionRef *ref) int main (int argc, char **argv) { - g_autoptr(GError) error = NULL; + g_autoptr (GError) error = NULL; setlocale (LC_ALL, ""); if (argc < 5 || (argc % 2) != 1) { - g_printerr ("Usage: %s REPO MOUNT-ROOT COLLECTION-ID REF-NAME [COLLECTION-ID REF-NAME …]\n", argv[0]); + g_printerr ("Usage: %s REPO MOUNT-ROOT COLLECTION-ID REF-NAME [COLLECTION-ID REF-NAME …]\n", + argv[0]); return 1; } - g_autoptr(GMainContext) context = g_main_context_new (); + g_autoptr (GMainContext) context = g_main_context_new (); g_main_context_push_thread_default (context); - g_autoptr(OstreeRepo) parent_repo = ostree_repo_open_at (AT_FDCWD, argv[1], NULL, &error); + g_autoptr (OstreeRepo) parent_repo = ostree_repo_open_at (AT_FDCWD, argv[1], NULL, &error); g_assert_no_error (error); /* Set up a mock volume. */ - g_autoptr(GFile) mount_root = g_file_new_for_commandline_arg (argv[2]); - g_autoptr(GMount) mount = G_MOUNT (ostree_mock_mount_new ("mount", mount_root)); + g_autoptr (GFile) mount_root = g_file_new_for_commandline_arg (argv[2]); + g_autoptr (GMount) mount = G_MOUNT (ostree_mock_mount_new ("mount", mount_root)); - g_autoptr(GList) mounts = g_list_prepend (NULL, mount); + g_autoptr (GList) mounts = g_list_prepend (NULL, mount); - g_autoptr(GVolumeMonitor) monitor = ostree_mock_volume_monitor_new (mounts, NULL); - g_autoptr(OstreeRepoFinderMount) finder = ostree_repo_finder_mount_new (monitor); + g_autoptr (GVolumeMonitor) monitor = ostree_mock_volume_monitor_new (mounts, NULL); + g_autoptr (OstreeRepoFinderMount) finder = ostree_repo_finder_mount_new (monitor); /* Resolve the refs. */ - g_autoptr(GPtrArray) refs = g_ptr_array_new_with_free_func ((GDestroyNotify) collection_ref_free0); + g_autoptr (GPtrArray) refs + = g_ptr_array_new_with_free_func ((GDestroyNotify)collection_ref_free0); for (gsize i = 3; i < argc; i += 2) { @@ -90,18 +90,18 @@ main (int argc, char **argv) g_ptr_array_add (refs, ostree_collection_ref_new (collection_id, ref_name)); } - g_ptr_array_add (refs, NULL); /* NULL terminator */ + g_ptr_array_add (refs, NULL); /* NULL terminator */ - g_autoptr(GAsyncResult) async_result = NULL; + g_autoptr (GAsyncResult) async_result = NULL; ostree_repo_finder_resolve_async (OSTREE_REPO_FINDER (finder), - (const OstreeCollectionRef * const *) refs->pdata, - parent_repo, NULL, result_cb, &async_result); + (const OstreeCollectionRef *const *)refs->pdata, parent_repo, + NULL, result_cb, &async_result); while (async_result == NULL) g_main_context_iteration (context, TRUE); - g_autoptr(GPtrArray) results = ostree_repo_finder_resolve_finish (OSTREE_REPO_FINDER (finder), - async_result, &error); + g_autoptr (GPtrArray) results + = ostree_repo_finder_resolve_finish (OSTREE_REPO_FINDER (finder), async_result, &error); g_assert_no_error (error); /* Check that the results are correct: the invalid refs should have been @@ -115,11 +115,9 @@ main (int argc, char **argv) g_hash_table_iter_init (&iter, result->ref_to_checksum); - while (g_hash_table_iter_next (&iter, (gpointer *) &ref, (gpointer *) &checksum)) - g_print ("%" G_GSIZE_FORMAT " %s %s %s %s\n", - i, ostree_remote_get_name (result->remote), - ref->collection_id, ref->ref_name, - checksum); + while (g_hash_table_iter_next (&iter, (gpointer *)&ref, (gpointer *)&checksum)) + g_print ("%" G_GSIZE_FORMAT " %s %s %s %s\n", i, ostree_remote_get_name (result->remote), + ref->collection_id, ref->ref_name, checksum); } g_main_context_pop_thread_default (context); |