Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 14 Jul 2016 09:26:53 +0000 (UTC)
From:      "Andrey A. Chernov" <ache@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r302827 - head/usr.bin/tr
Message-ID:  <201607140926.u6E9QrIt028337@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ache
Date: Thu Jul 14 09:26:53 2016
New Revision: 302827
URL: https://svnweb.freebsd.org/changeset/base/302827

Log:
  Optimize [Cc]flag case: don't repeatedly add the last character of
  string2 to squeeze cset when string2 reach its EOS state.

Modified:
  head/usr.bin/tr/tr.c

Modified: head/usr.bin/tr/tr.c
==============================================================================
--- head/usr.bin/tr/tr.c	Thu Jul 14 09:24:55 2016	(r302826)
+++ head/usr.bin/tr/tr.c	Thu Jul 14 09:26:53 2016	(r302827)
@@ -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) &&



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201607140926.u6E9QrIt028337>