diff options
author | 2011-07-24 13:59:15 +0000 | |
---|---|---|
committer | 2011-07-24 13:59:15 +0000 | |
commit | ef4c7e31e87a88c6e978b5292605528433236266 (patch) | |
tree | cafc29adbf3368c4b2a7dd8efe477666d7f486a9 /lib/libc/stdlib/system.c | |
parent | Also run the new tests of "sed -E 's/..." with the input lacking a (diff) | |
download | wireguard-openbsd-ef4c7e31e87a88c6e978b5292605528433236266.tar.xz wireguard-openbsd-ef4c7e31e87a88c6e978b5292605528433236266.zip |
Rewrite the main loop of the "sed s/..." command, shortening it by ten
lines and simplifying it by removing the switch statement implementing
/g, /1, and /2 separately and repetitively.
The idea to make the loop control variable slen, i.e. the length of the
string remaining to be processed, signed, and stay in the loop even when
slen == 0 (i.e. at the end of the string), lifted from FreeBSD by otto@.
On i386, process.o shrinks by 440 bytes, and the sed binary by 23 bytes.
This fixes multiple aspects of the replacement of multiple (/g) or
specific (e.g. /2) instances of zero-length matches, both with BREs and
EREs, both with and without a trailing newline character on the input.
Feedback and OK otto@.
Diffstat (limited to 'lib/libc/stdlib/system.c')
0 files changed, 0 insertions, 0 deletions