summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Walters <walters@verbum.org>2017-03-28 22:31:03 -0400
committerAtomic Bot <atomic-devel@projectatomic.io>2017-03-30 13:14:43 +0000
commit8392faaffc44ac7f171279b961efab7418f5b45f (patch)
tree2c89cbae83bf30cc2e8c527eaddf05718fe70c66
parentb51ce8cb0ac16074a5a3b5656247d9dd6a8884c3 (diff)
downloadostree-8392faaffc44ac7f171279b961efab7418f5b45f.tar.gz
lib: Delete old GFile path helpers, and migrate single last user
I happened to read this file and realized there's a lot of cruft left over from the time when I liked `GFile` and `malloc()`ing like 50 times just to make a pathname string. Delete it. Closes: #767 Approved by: jlebon
-rw-r--r--src/libostree/ostree-sysroot-deploy.c4
-rw-r--r--src/libotutil/ot-gio-utils.c85
-rw-r--r--src/libotutil/ot-gio-utils.h6
3 files changed, 2 insertions, 93 deletions
diff --git a/src/libostree/ostree-sysroot-deploy.c b/src/libostree/ostree-sysroot-deploy.c
index ee25d3f0..0db09973 100644
--- a/src/libostree/ostree-sysroot-deploy.c
+++ b/src/libostree/ostree-sysroot-deploy.c
@@ -2003,11 +2003,11 @@ allocate_deployserial (OstreeSysroot *self,
{
guint i;
int new_deployserial = 0;
- g_autoptr(GFile) osdir = NULL;
g_autoptr(GPtrArray) tmp_current_deployments =
g_ptr_array_new_with_free_func (g_object_unref);
- osdir = ot_gfile_get_child_build_path (self->path, "ostree/deploy", osname, NULL);
+ const char *osdir_name = glnx_strjoina ("ostree/deploy/", osname);
+ g_autoptr(GFile) osdir = g_file_resolve_relative_path (self->path, osdir_name);
if (!_ostree_sysroot_list_deployment_dirs_for_os (osdir, tmp_current_deployments,
cancellable, error))
diff --git a/src/libotutil/ot-gio-utils.c b/src/libotutil/ot-gio-utils.c
index da32653e..51c29f39 100644
--- a/src/libotutil/ot-gio-utils.c
+++ b/src/libotutil/ot-gio-utils.c
@@ -52,91 +52,6 @@ ot_gfile_type_for_mode (guint32 mode)
GFile *
-ot_gfile_from_build_path (const char *first, ...)
-{
- va_list args;
- const char *arg;
- g_autofree char *path = NULL;
- g_autoptr(GPtrArray) components = NULL;
-
- va_start (args, first);
-
- components = g_ptr_array_new ();
-
- arg = first;
- while (arg != NULL)
- {
- g_ptr_array_add (components, (char*)arg);
- arg = va_arg (args, const char *);
- }
-
- va_end (args);
-
- g_ptr_array_add (components, NULL);
-
- path = g_build_filenamev ((char**)components->pdata);
-
- return g_file_new_for_path (path);
-}
-
-GFile *
-ot_gfile_get_child_strconcat (GFile *parent,
- const char *first,
- ...)
-{
- va_list args;
- GFile *ret;
- GString *buf;
- const char *arg;
-
- g_return_val_if_fail (first != NULL, NULL);
-
- va_start (args, first);
-
- buf = g_string_new (first);
-
- while ((arg = va_arg (args, const char *)) != NULL)
- g_string_append (buf, arg);
-
- va_end (args);
-
- ret = g_file_get_child (parent, buf->str);
-
- g_string_free (buf, TRUE);
-
- return ret;
-}
-
-GFile *
-ot_gfile_get_child_build_path (GFile *parent,
- const char *first, ...)
-{
- va_list args;
- const char *arg;
- g_autofree char *path = NULL;
- g_autoptr(GPtrArray) components = NULL;
-
- va_start (args, first);
-
- components = g_ptr_array_new ();
-
- arg = first;
- while (arg != NULL)
- {
- g_ptr_array_add (components, (char*)arg);
- arg = va_arg (args, const char *);
- }
-
- va_end (args);
-
- g_ptr_array_add (components, NULL);
-
- path = g_build_filenamev ((char**)components->pdata);
-
- return g_file_resolve_relative_path (parent, path);
-}
-
-GFile *
ot_gfile_resolve_path_printf (GFile *path,
const char *format,
...)
diff --git a/src/libotutil/ot-gio-utils.h b/src/libotutil/ot-gio-utils.h
index 34040238..fa7c6997 100644
--- a/src/libotutil/ot-gio-utils.h
+++ b/src/libotutil/ot-gio-utils.h
@@ -35,12 +35,6 @@ G_BEGIN_DECLS
GFileType ot_gfile_type_for_mode (guint32 mode);
-GFile *ot_gfile_from_build_path (const char *first, ...) G_GNUC_NULL_TERMINATED;
-
-GFile *ot_gfile_get_child_strconcat (GFile *parent, const char *first, ...) G_GNUC_NULL_TERMINATED;
-
-GFile *ot_gfile_get_child_build_path (GFile *parent, const char *first, ...) G_GNUC_NULL_TERMINATED;
-
GFile * ot_gfile_resolve_path_printf (GFile *path,
const char *format,
...) G_GNUC_PRINTF(2, 3);