Page MenuHomeFreeBSD

cam: scsi_enc_ses: Remove an unnecessary VLA construction
AbandonedPublic

Authored by cem on May 16 2020, 3:35 AM.
Tags
None
Referenced Files
Unknown Object (File)
Jan 8 2024, 5:32 AM
Unknown Object (File)
Dec 20 2023, 8:05 AM
Unknown Object (File)
Nov 12 2023, 6:21 AM
Unknown Object (File)
Nov 7 2023, 9:02 AM
Unknown Object (File)
Oct 11 2023, 5:21 AM
Unknown Object (File)
Oct 6 2023, 7:56 AM
Unknown Object (File)
Aug 8 2023, 8:04 PM
Unknown Object (File)
Apr 25 2023, 7:11 PM
Subscribers
None

Details

Reviewers
imp
scottl
jhb
Group Reviewers
cam
Summary

The array size is known at compile time; we don't need a C variable-length
array. Extract the constant into a short-lived macro and use it to size the
array. Pull the array out to function scope while here.

Diff Detail

Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 31107
Build 28796: arc lint + arc unit

Event Timeline

cem requested review of this revision.May 16 2020, 3:35 AM

*shrug* Given the function already defines variables in scope I'm not sure it really matters to pull it out to the top-level (esp in light of the recent style(9) change Warner is working on). Presumably this is all the same for the compiler anyway?

In D24856#560905, @jhb wrote:

*shrug* Given the function already defines variables in scope I'm not sure it really matters to pull it out to the top-level (esp in light of the recent style(9) change Warner is working on).

It doesn’t have to be top-level in light of the more recent style9 developments.

Presumably this is all the same for the compiler anyway?

Initially I wrote this because sparse is a dumber compiler and didn’t have a good way to disable a Werror vla warning, but I’ve extended that tool to make it optional. So this change isn’t a big deal either way; the VLA construction is unnecessary either way.