summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2023-09-06 16:28:12 -0400
committerTavian Barnes <tavianator@tavianator.com>2023-09-06 16:35:39 -0400
commit4f9762218079c4d83eb30065804367506da8330d (patch)
tree3408add9c03a072ce119578a7a77947cfd9bd271 /src
parent90f9205b40b2f2049df46d819d14d67bfcb055be (diff)
downloadbfs-4f9762218079c4d83eb30065804367506da8330d.tar.xz
bfstd: Skip a whole loop in dollar_quote() if possible
Diffstat (limited to 'src')
-rw-r--r--src/bfstd.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/bfstd.c b/src/bfstd.c
index 61d2fee..c858910 100644
--- a/src/bfstd.c
+++ b/src/bfstd.c
@@ -724,10 +724,9 @@ static char *dollar_quote(char *dest, char *end, const char *str, size_t len, en
safe = xiswprint(wc, flags);
}
- for (size_t j = start; j < i; ++j) {
+ for (size_t j = start; safe && j < i; ++j) {
if (str[j] == '\'' || str[j] == '\\') {
safe = false;
- break;
}
}