summaryrefslogtreecommitdiffstats
path: root/usr.bin
diff options
context:
space:
mode:
authorache <ache@FreeBSD.org>2016-07-22 19:36:11 +0000
committerache <ache@FreeBSD.org>2016-07-22 19:36:11 +0000
commit50a74c885b2a6cfd6445aba6536864966f6e655e (patch)
treee1ab1386af98f423d0c9052ff23044e2b4b36f1f /usr.bin
parent955b3cb5995cc078b3bbfc0cbedeec859a1a9e66 (diff)
downloadFreeBSD-src-50a74c885b2a6cfd6445aba6536864966f6e655e.zip
FreeBSD-src-50a74c885b2a6cfd6445aba6536864966f6e655e.tar.gz
MFC: r302827
Optimize [Cc]flag case: don't repeatedly add the last character of string2 to squeeze cset when string2 reach its EOS state.
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/tr/tr.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/usr.bin/tr/tr.c b/usr.bin/tr/tr.c
index 6eea2cb..d54e74c 100644
--- a/usr.bin/tr/tr.c
+++ b/usr.bin/tr/tr.c
@@ -272,10 +272,11 @@ endloop:
if (Cflag && !iswrune(cnt))
continue;
if (cmap_lookup(map, cnt) == OOBCH) {
- if (next(&s2))
+ if (next(&s2)) {
cmap_add(map, cnt, s2.lastch);
- if (sflag)
- cset_add(squeeze, s2.lastch);
+ if (sflag)
+ cset_add(squeeze, s2.lastch);
+ }
} else
cmap_add(map, cnt, cnt);
if ((s2.state == EOS || s2.state == INFINITE) &&
OpenPOWER on IntegriCloud