path: allocate buffer in fs_charset conversion functions

Don't use fixed static buffers.  GLib allocates a new string for us
anyway, let's just return this one instead of copying it.
This commit is contained in:
Max Kellermann
2009-01-08 21:20:46 +01:00
parent f0980283bc
commit 5ed5aa99ac
6 changed files with 55 additions and 46 deletions

View File

@@ -545,15 +545,19 @@ updateDirectory(struct directory *directory, const struct stat *st)
if (skip_path(ent->d_name))
continue;
utf8 = fs_charset_to_utf8(path_max_tmp, ent->d_name);
if (utf8 == NULL || skip_symlink(directory, utf8))
utf8 = fs_charset_to_utf8(ent->d_name);
if (utf8 == NULL || skip_symlink(directory, utf8)) {
g_free(utf8);
continue;
}
if (stat_directory_child(directory, utf8, &st2) == 0)
updateInDirectory(directory,
path_max_tmp, &st2);
else
delete_name_in(directory, path_max_tmp);
g_free(utf8);
}
closedir(dir);