core: Use ot_gfile_get_path_cached() pervasively

This requires no free() calls and is just better.
This commit is contained in:
Colin Walters committed 2011-11-17 18:23:36 -05:00
1 parent 8a24861763
commit a8735778f0
8 files changed
+38 -55

No files matched your search

+2 -3
View File
@@ -121,9 +121,9 @@ ot_util_read_file_noatime (GFile *file, GCancellable *cancellable, GError **erro
GInputStream *ret = NULL;
int fd;
int flags = O_RDONLY;
char *path = NULL;
const char *path = NULL;
path = g_file_get_path (file);
path = ot_gfile_get_path_cached (file);
#ifdef O_NOATIME
flags |= O_NOATIME;
#endif
@@ -137,7 +137,6 @@ ot_util_read_file_noatime (GFile *file, GCancellable *cancellable, GError **erro
ret = (GInputStream*)g_unix_input_stream_new (fd, TRUE);
out:
g_free (path);
return ret;
}
+2 -3
View File
@@ -96,10 +96,10 @@ ot_util_variant_map (GFile *src,
{
gboolean ret = FALSE;
GMappedFile *mfile = NULL;
char *path = NULL;
const char *path = NULL;
GVariant *ret_variant = NULL;
path = g_file_get_path (src);
path = ot_gfile_get_path_cached (src);
mfile = g_mapped_file_new (path, FALSE, error);
if (!mfile)
goto out;
@@ -121,6 +121,5 @@ ot_util_variant_map (GFile *src,
g_variant_unref (ret_variant);
if (mfile)
g_mapped_file_unref (mfile);
g_free (path);
return ret;
}