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
This commit is contained in:
parent
b51ce8cb0a
commit
8392faaffc
|
|
@ -2003,11 +2003,11 @@ allocate_deployserial (OstreeSysroot *self,
|
||||||
{
|
{
|
||||||
guint i;
|
guint i;
|
||||||
int new_deployserial = 0;
|
int new_deployserial = 0;
|
||||||
g_autoptr(GFile) osdir = NULL;
|
|
||||||
g_autoptr(GPtrArray) tmp_current_deployments =
|
g_autoptr(GPtrArray) tmp_current_deployments =
|
||||||
g_ptr_array_new_with_free_func (g_object_unref);
|
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,
|
if (!_ostree_sysroot_list_deployment_dirs_for_os (osdir, tmp_current_deployments,
|
||||||
cancellable, error))
|
cancellable, error))
|
||||||
|
|
|
||||||
|
|
@ -51,91 +51,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 *
|
GFile *
|
||||||
ot_gfile_resolve_path_printf (GFile *path,
|
ot_gfile_resolve_path_printf (GFile *path,
|
||||||
const char *format,
|
const char *format,
|
||||||
|
|
|
||||||
|
|
@ -35,12 +35,6 @@ G_BEGIN_DECLS
|
||||||
|
|
||||||
GFileType ot_gfile_type_for_mode (guint32 mode);
|
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,
|
GFile * ot_gfile_resolve_path_printf (GFile *path,
|
||||||
const char *format,
|
const char *format,
|
||||||
...) G_GNUC_PRINTF(2, 3);
|
...) G_GNUC_PRINTF(2, 3);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue