summaryrefslogtreecommitdiffstats
path: root/lib/libc/stdlib/labs.c
diff options
context:
space:
mode:
authorschwarze <schwarze@openbsd.org>2011-07-24 13:59:15 +0000
committerschwarze <schwarze@openbsd.org>2011-07-24 13:59:15 +0000
commitef4c7e31e87a88c6e978b5292605528433236266 (patch)
treecafc29adbf3368c4b2a7dd8efe477666d7f486a9 /lib/libc/stdlib/labs.c
parentAlso run the new tests of "sed -E 's/..." with the input lacking a (diff)
downloadwireguard-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/labs.c')
0 files changed, 0 insertions, 0 deletions