HomeFreeBSD

wc: Make the read buffer static.

Description

wc: Make the read buffer static.

The read buffer in cnt() is 64 kB, which is a bit excessive for a stack variable. MAXBSIZE has grown since this code was originally written, and it might grow again in the future. Since the program is single-threaded and cnt() does not recurse, we can safely make the buffer static.

While there, constify p since it is only used to read.

Sponsored by: Klara, Inc.
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D38608

Details

Provenance
desAuthored on Feb 16 2023, 12:40 AM
Reviewer
emaste
Differential Revision
D38608: wc: Make the read buffer static.
Parents
rG5c870e1b4894: wc: Improve test coverage.
Branches
Unknown
Tags
Unknown