Do not dribble zero bytes into the output, by replacing an obfuscated if

whose true and false clauses were equivalent with a check that we are
not about to stumble off the end of the line.

Reported by:	peter
Pointy hat to:	fanf
This commit is contained in:
Tony Finch 2003-06-05 12:10:19 +00:00
parent 30ef7aacc2
commit c2b9b6eba8
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=115871

View File

@ -362,10 +362,7 @@ substitute(cp)
slen -= match[0].rm_eo;
lastempty = 0;
} else {
if (match[0].rm_so == 0)
cspace(&SS, s, match[0].rm_so + 1,
APPEND);
else
if (match[0].rm_so < slen)
cspace(&SS, s + match[0].rm_so, 1,
APPEND);
s += match[0].rm_so + 1;