about summary refs log tree commit diff
diff options
context:
space:
mode:
authorLeah Neukirchen <leah@vuxu.org>2019-12-05 22:02:27 +0100
committerLeah Neukirchen <leah@vuxu.org>2019-12-05 22:02:27 +0100
commit038a24297765890afd349f64f3eb5951fae96e5c (patch)
tree22c49551e9d3c8b7fa3e046005782f2d1c217dd4
parentcdadc0f97d6baea98eb4780e69af816ba0070f56 (diff)
downloadlr-038a24297765890afd349f64f3eb5951fae96e5c.tar.gz
lr-038a24297765890afd349f64f3eb5951fae96e5c.tar.xz
lr-038a24297765890afd349f64f3eb5951fae96e5c.zip
print_shquoted: fast-path for unescaped file name output
-rw-r--r--lr.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/lr.c b/lr.c
index ffd4ca3..228766d 100644
--- a/lr.c
+++ b/lr.c
@@ -1714,6 +1714,12 @@ print_shquoted(const char *s)
 
 	const char *t;
 	int esc = 0;
+
+	if (!Qflag) {
+		printf("%s", s);
+		return;
+	}
+
 	for (t = s; *t; ) {
 		if ((unsigned char)*t <= 32 ||
 		    strchr("`^#*[]=|\\?${}()'\"<>&;\177", *t)) {
@@ -1728,7 +1734,7 @@ print_shquoted(const char *s)
 		}
 	}
 
-	if (!Qflag || !esc) {
+	if (!esc) {
 		printf("%s", s);
 		return;
 	}