diff options
author | ache <ache@FreeBSD.org> | 2016-08-17 09:12:02 +0000 |
---|---|---|
committer | ache <ache@FreeBSD.org> | 2016-08-17 09:12:02 +0000 |
commit | bcb305f89d605e610c5188a3ca611fa1f3c767d9 (patch) | |
tree | 62154ad2234f3bde73b4ee9559e7474ef097ff1e /usr.bin | |
parent | 9d53c4513ef5db9004bacbb1c2fc91157f938131 (diff) | |
download | FreeBSD-src-bcb305f89d605e610c5188a3ca611fa1f3c767d9.zip FreeBSD-src-bcb305f89d605e610c5188a3ca611fa1f3c767d9.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.c | 7 |
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) && |