mirror of
https://github.com/MidnightCommander/mc
synced 2025-03-11 18:32:53 +03:00
(path_trunc): optimization.
Get rid of double conversion of path: remove passwords using vfs_path_from_str_flags (path, VPF_STRIP_PASSWORD). Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
parent
5a67afc812
commit
a802f14c2e
@ -332,16 +332,12 @@ const char *
|
|||||||
path_trunc (const char *path, size_t trunc_len)
|
path_trunc (const char *path, size_t trunc_len)
|
||||||
{
|
{
|
||||||
vfs_path_t *vpath;
|
vfs_path_t *vpath;
|
||||||
char *secure_path;
|
|
||||||
const char *ret;
|
const char *ret;
|
||||||
|
|
||||||
vpath = vfs_path_from_str (path);
|
vpath = vfs_path_from_str_flags (path, VPF_STRIP_PASSWORD);
|
||||||
secure_path = vfs_path_to_str_flags (vpath, 0, VPF_STRIP_PASSWORD);
|
ret = str_trunc (vfs_path_as_str (vpath), trunc_len);
|
||||||
vfs_path_free (vpath, TRUE);
|
vfs_path_free (vpath, TRUE);
|
||||||
|
|
||||||
ret = str_trunc (secure_path, trunc_len);
|
|
||||||
g_free (secure_path);
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user