Page MenuHomeFreeBSD

xstr(1): various cleanup
AbandonedPublic

Authored by eadler on Jan 7 2018, 5:12 AM.
Tags
None
Referenced Files
F85705433: D13789.diff
Sun, Jun 9, 9:19 AM
Unknown Object (File)
Wed, May 22, 4:27 AM
Unknown Object (File)
Wed, May 22, 2:53 AM
Unknown Object (File)
Tue, May 21, 12:24 PM
Unknown Object (File)
Tue, May 21, 12:21 PM
Unknown Object (File)
Tue, May 21, 4:51 AM
Unknown Object (File)
Tue, May 14, 3:51 AM
Unknown Object (File)
May 4 2024, 12:15 PM
Subscribers
None

Details

Reviewers
imp
dim
des
Summary
  • use char where possible
  • avoid comma operator
  • remove 'lint' support
  • add attribute noreturn

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 14211
Build 14374: arc lint + arc unit

Event Timeline

use __dead2 instead of naked attribute

des requested changes to this revision.Jan 9 2018, 7:35 AM
des added inline comments.
usr.bin/xstr/xstr.c
139–140

Pull up the else, or just remove it entirely as the result is the same either way (readstd ends up equal to zero).

235

This is unnecessary and forces the compiler to ensure that all arithemetic is done modulo 256, which may increase the code size.

276–277

This can also be written more legibly as

c = c << 3 + *cp++ - '0';
319

c must be an int for EOF detection to work reliably.

This revision now requires changes to proceed.Jan 9 2018, 7:35 AM
eadler added inline comments.
usr.bin/xstr/xstr.c
319

you're right. I forgot about this :\

eadler marked an inline comment as done.

per @des

I'm sorry for the lack of response, I thought this had landed already.

Upon closer inspection, I think I was mistaken about readstd, and the assignment to 0 is necessary. Have you tested all three possible cases (dash only, filenames only, both dash and filenames)?