Page MenuHomeFreeBSD

cam: scsi_enc_ses: Remove an unnecessary VLA construction
Needs ReviewPublic

Authored by cem on May 16 2020, 3:35 AM.

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 OK
Unit
No Unit Test Coverage
Build Status
Buildable 31107
Build 28796: arc lint + arc unit

Event Timeline

cem created this revision.May 16 2020, 3:35 AM
cem requested review of this revision.May 16 2020, 3:35 AM
jhb added a comment.Jun 23 2020, 4:55 PM

*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?

cem added a comment.Jun 23 2020, 5:01 PM
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.