From a802f14c2e8d7262b1ca444a5a7a0db1652c8053 Mon Sep 17 00:00:00 2001 From: Andrew Borodin Date: Tue, 21 May 2024 21:49:58 +0300 Subject: [PATCH] (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 --- lib/util.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/lib/util.c b/lib/util.c index b766f7ca1..d6fd3850f 100644 --- a/lib/util.c +++ b/lib/util.c @@ -332,16 +332,12 @@ const char * path_trunc (const char *path, size_t trunc_len) { vfs_path_t *vpath; - char *secure_path; const char *ret; - vpath = vfs_path_from_str (path); - secure_path = vfs_path_to_str_flags (vpath, 0, VPF_STRIP_PASSWORD); + vpath = vfs_path_from_str_flags (path, VPF_STRIP_PASSWORD); + ret = str_trunc (vfs_path_as_str (vpath), trunc_len); vfs_path_free (vpath, TRUE); - ret = str_trunc (secure_path, trunc_len); - g_free (secure_path); - return ret; }