avoid unnecessary filename conversions.

2005-03-09  Sven Neumann  <sven@gimp.org>

	* glib/gfileutils.c (g_file_replace): avoid unnecessary filename
	conversions.
This commit is contained in:
Sven Neumann 2005-03-09 11:22:09 +00:00 committed by Sven Neumann
parent 1607e3f1d0
commit cd8a0ac41f
5 changed files with 25 additions and 9 deletions

View File

@ -1,3 +1,8 @@
2005-03-09 Sven Neumann <sven@gimp.org>
* glib/gfileutils.c (g_file_replace): avoid unnecessary filename
conversions.
2005-03-09 Tor Lillqvist <tml@novell.com>
* glib/gutils.c (g_get_user_data_dir, g_get_user_config_dir,

View File

@ -1,3 +1,8 @@
2005-03-09 Sven Neumann <sven@gimp.org>
* glib/gfileutils.c (g_file_replace): avoid unnecessary filename
conversions.
2005-03-09 Tor Lillqvist <tml@novell.com>
* glib/gutils.c (g_get_user_data_dir, g_get_user_config_dir,

View File

@ -1,3 +1,8 @@
2005-03-09 Sven Neumann <sven@gimp.org>
* glib/gfileutils.c (g_file_replace): avoid unnecessary filename
conversions.
2005-03-09 Tor Lillqvist <tml@novell.com>
* glib/gutils.c (g_get_user_data_dir, g_get_user_config_dir,

View File

@ -1,3 +1,8 @@
2005-03-09 Sven Neumann <sven@gimp.org>
* glib/gfileutils.c (g_file_replace): avoid unnecessary filename
conversions.
2005-03-09 Tor Lillqvist <tml@novell.com>
* glib/gutils.c (g_get_user_data_dir, g_get_user_config_dir,

View File

@ -984,9 +984,7 @@ g_file_replace (const gchar *filename,
gssize length,
GError **error)
{
char *tmp_filename = NULL;
char *display_filename = NULL;
char *display_tmpname = NULL;
gchar *tmp_filename;
gboolean retval;
GError *rename_error = NULL;
@ -1005,9 +1003,6 @@ g_file_replace (const gchar *filename,
goto out;
}
display_tmpname = g_filename_display_name (tmp_filename);
display_filename = g_filename_display_name (filename);
if (!rename_file (tmp_filename, filename, &rename_error))
{
#ifndef G_OS_WIN32
@ -1035,13 +1030,16 @@ g_file_replace (const gchar *filename,
if (g_unlink (filename) == -1)
{
gchar *display_filename = g_filename_display_name (filename);
g_set_error (error,
G_FILE_ERROR,
g_file_error_from_errno (errno),
_("Existing file '%s' could not be removed: g_unlink() failed: %s"),
display_filename,
g_strerror (errno));
g_free (display_filename);
g_unlink (tmp_filename);
retval = FALSE;
goto out;
@ -1060,8 +1058,6 @@ g_file_replace (const gchar *filename,
retval = TRUE;
out:
g_free (display_tmpname);
g_free (display_filename);
g_free (tmp_filename);
return retval;
}