From 3ad2d46cff24444a099c2165c2cbe2c57fe0d268 Mon Sep 17 00:00:00 2001 From: Ellen Marie Dash Date: Fri, 28 Aug 2020 12:48:06 -0400 Subject: [PATCH] [mv] Avoid calling `normalize_dest()` when it's not required. --- src/mv.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/mv.c b/src/mv.c index 1485943..f82acda 100644 --- a/src/mv.c +++ b/src/mv.c @@ -112,10 +112,12 @@ int main(int argc, char **argv) { } for (; i < argc - 1; i++) { - char *normalized_dest = normalize_dest(argv[i], dest); - if (should_prompt && access(normalized_dest, F_OK) == 0) { - if (prompt(normalized_dest) == 0) { - continue; + if (should_prompt) { + char *normalized_dest = normalize_dest(argv[i], dest); + if (access(normalized_dest, F_OK) == 0) { + if (prompt(normalized_dest) == 0) { + continue; + } } }