summaryrefslogtreecommitdiff
path: root/src/ostree/ot-editor.c
diff options
context:
space:
mode:
authorColin Walters <walters@verbum.org>2023-05-03 08:24:21 -0400
committerGitHub <noreply@github.com>2023-05-03 08:24:21 -0400
commit8a2993a9d01cc358e4c2d936ca132174aabdc714 (patch)
tree5402001ab710dadfd51ba3e9071b044016030e3e /src/ostree/ot-editor.c
parentdd70c9b78cc34ccc7e638eda4c2df1ddd8ee3add (diff)
parentc1044a02b28982ef6dd58af98b23a40482d26487 (diff)
downloadostree-8a2993a9d01cc358e4c2d936ca132174aabdc714.tar.gz
Merge pull request #2565 from cgwalters/clang-format
Add .clang-format file + tree-wide: Run `clang-format`
Diffstat (limited to 'src/ostree/ot-editor.c')
-rw-r--r--src/ostree/ot-editor.c26
1 files changed, 11 insertions, 15 deletions
diff --git a/src/ostree/ot-editor.c b/src/ostree/ot-editor.c
index 706a5299..7b2e2512 100644
--- a/src/ostree/ot-editor.c
+++ b/src/ostree/ot-editor.c
@@ -22,11 +22,11 @@
#include "config.h"
#include "libglnx.h"
-#include "otutil.h"
#include "ot-editor.h"
+#include "otutil.h"
-#include <sys/wait.h>
#include <string.h>
+#include <sys/wait.h>
#ifndef DEFAULT_EDITOR
#define DEFAULT_EDITOR "vi"
@@ -56,14 +56,11 @@ get_editor (void)
}
char *
-ot_editor_prompt (OstreeRepo *repo,
- const char *input,
- GCancellable *cancellable,
- GError **error)
+ot_editor_prompt (OstreeRepo *repo, const char *input, GCancellable *cancellable, GError **error)
{
glnx_unref_object GSubprocess *proc = NULL;
- g_autoptr(GFile) file = NULL;
- g_autoptr(GFileIOStream) io = NULL;
+ g_autoptr (GFile) file = NULL;
+ g_autoptr (GFileIOStream) io = NULL;
GOutputStream *output;
const char *editor;
char *ret = NULL;
@@ -82,8 +79,8 @@ ot_editor_prompt (OstreeRepo *repo,
goto out;
output = g_io_stream_get_output_stream (G_IO_STREAM (io));
- if (!g_output_stream_write_all (output, input, strlen (input), NULL, cancellable, error) ||
- !g_io_stream_close (G_IO_STREAM (io), cancellable, error))
+ if (!g_output_stream_write_all (output, input, strlen (input), NULL, cancellable, error)
+ || !g_io_stream_close (G_IO_STREAM (io), cancellable, error))
goto out;
{
@@ -91,8 +88,7 @@ ot_editor_prompt (OstreeRepo *repo,
args = g_strconcat (editor, " ", quoted_file, NULL);
}
- proc = g_subprocess_new (G_SUBPROCESS_FLAGS_STDIN_INHERIT, error,
- "/bin/sh", "-c", args, NULL);
+ proc = g_subprocess_new (G_SUBPROCESS_FLAGS_STDIN_INHERIT, error, "/bin/sh", "-c", args, NULL);
if (!g_subprocess_wait_check (proc, cancellable, error))
{
@@ -100,11 +96,11 @@ ot_editor_prompt (OstreeRepo *repo,
goto out;
}
- ret = glnx_file_get_contents_utf8_at (AT_FDCWD, gs_file_get_path_cached (file), NULL,
- cancellable, error);
+ ret = glnx_file_get_contents_utf8_at (AT_FDCWD, gs_file_get_path_cached (file), NULL, cancellable,
+ error);
out:
if (file)
- (void )g_file_delete (file, NULL, NULL);
+ (void)g_file_delete (file, NULL, NULL);
return ret;
}