Drop calls to gs_file_rename

We make an equivalent helper inline.
tingping/wmclass
Alexander Larsson 2016-08-22 15:27:31 +02:00
parent 289ae4474b
commit c14fbc3efb
3 changed files with 32 additions and 9 deletions

View File

@ -1083,9 +1083,9 @@ flatpak_dir_deploy_appstream (FlatpakDir *self,
return FALSE;
}
if (!gs_file_rename (active_tmp_link,
active_link,
cancellable, error))
if (!flatpak_file_rename (active_tmp_link,
active_link,
cancellable, error))
return FALSE;
if (old_checksum != NULL &&
@ -1900,9 +1900,9 @@ flatpak_dir_set_active (FlatpakDir *self,
if (!g_file_make_symbolic_link (active_tmp_link, checksum, cancellable, error))
goto out;
if (!gs_file_rename (active_tmp_link,
active_link,
cancellable, error))
if (!flatpak_file_rename (active_tmp_link,
active_link,
cancellable, error))
goto out;
}
else
@ -3720,9 +3720,9 @@ flatpak_dir_undeploy (FlatpakDir *self,
glnx_gen_temp_name (tmpname);
removed_subdir = g_file_get_child (removed_dir, tmpname);
if (!gs_file_rename (checkoutdir,
removed_subdir,
cancellable, error))
if (!flatpak_file_rename (checkoutdir,
removed_subdir,
cancellable, error))
goto out;
if (force_remove || !dir_is_locked (removed_subdir))

View File

@ -1659,6 +1659,24 @@ flatpak_rm_rf (GFile *dir,
cancellable, error);
}
gboolean flatpak_file_rename (GFile *from,
GFile *to,
GCancellable *cancellable,
GError **error)
{
if (g_cancellable_set_error_if_cancelled (cancellable, error))
return FALSE;
if (rename (flatpak_file_get_path_cached (from),
flatpak_file_get_path_cached (to)) < 0)
{
glnx_set_error_from_errno (error);
return FALSE;
}
return TRUE;
}
gboolean
flatpak_variant_save (GFile *dest,
GVariant *variant,

View File

@ -290,6 +290,11 @@ gboolean flatpak_rm_rf (GFile *dir,
GCancellable *cancellable,
GError **error);
gboolean flatpak_file_rename (GFile *from,
GFile *to,
GCancellable *cancellable,
GError **error);
#define flatpak_autorm_rf _GLIB_CLEANUP (g_autoptr_cleanup_generic_gfree)
static inline void