summaryrefslogtreecommitdiff
path: root/src/ostree/ot-builtin-admin.c
diff options
context:
space:
mode:
authorColin Walters <walters@verbum.org>2017-05-05 10:44:49 -0400
committerAtomic Bot <atomic-devel@projectatomic.io>2017-05-05 15:10:51 +0000
commit712bf219141bdb13c42629d518578b62906fcaa7 (patch)
tree4d1c62122eee6dbed8b1af8549fe7df4b3c8e90c /src/ostree/ot-builtin-admin.c
parentbf9772f2316a567566c20979e5247b2928287253 (diff)
downloadostree-712bf219141bdb13c42629d518578b62906fcaa7.tar.gz
tree-wide: Convert to using autoptr(GString) vs g_string_free(...,TRUE)
If we're freeing the segment, it's basically always better to use `autoptr()`. Fewer lines, more reliable, etc. Noticed an instance of this in the pull code while reviewing a different PR, decided to do a grep for it and fix it tree wide. Closes: #836 Approved by: pwithnall
Diffstat (limited to 'src/ostree/ot-builtin-admin.c')
-rw-r--r--src/ostree/ot-builtin-admin.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/src/ostree/ot-builtin-admin.c b/src/ostree/ot-builtin-admin.c
index 0d8290a8..16aaec03 100644
--- a/src/ostree/ot-builtin-admin.c
+++ b/src/ostree/ot-builtin-admin.c
@@ -56,12 +56,9 @@ static GOptionContext *
ostree_admin_option_context_new_with_commands (void)
{
OstreeAdminCommand *command = admin_subcommands;
- GOptionContext *context;
- GString *summary;
+ GOptionContext *context = g_option_context_new ("--print-current-dir|COMMAND");
- context = g_option_context_new ("--print-current-dir|COMMAND");
-
- summary = g_string_new ("Builtin \"admin\" Commands:");
+ g_autoptr(GString) summary = g_string_new ("Builtin \"admin\" Commands:");
while (command->name != NULL)
{
@@ -71,8 +68,6 @@ ostree_admin_option_context_new_with_commands (void)
g_option_context_set_summary (context, summary->str);
- g_string_free (summary, TRUE);
-
return context;
}