nuttx-apps icon indicating copy to clipboard operation
nuttx-apps copied to clipboard

testing/sd_*: Restrict function and variable scope to current file.

Open g2gps opened this issue 1 year ago • 2 comments

Summary

Add the static keyword to required function and variable delcaration to reduce their scope. Stops namespace pollution in CONFIG_BUILD_FLAT

Impact

Stops symbol collision when CONFIG_TESTING_SD_BENCH and CONFIG_TESTING_SD_STRESS are enables simultaneously.

Testing

Enable CONFIG_TESTING_SD_BENCH and CONFIG_TESTING_SD_STRESS at the same time.

g2gps avatar Nov 17 '23 04:11 g2gps

Why not allocate these in a struct and reduce memory footprint that just including that app costs?

Could you please expand more with maybe a kind of example. I'm not fully following your proposal. I think all those local static consts will be optimized out by compiler anyway.

pkarashchenko avatar Nov 17 '23 13:11 pkarashchenko

Why not allocate these in a struct and reduce memory footprint that just including that app costs?

Could you please expand more with maybe a kind of example. I'm not fully following your proposal. I think all those local static consts will be optimized out by compiler anyway.

I did not think these were local. Also as globals they do not conform to the coding standard.

My point was placing all the variables in a struct allocated at run time will reduce the data size to a single pointer or 0 if it is passed as an argument.

davids5 avatar Nov 20 '23 14:11 davids5

ping @g2gps

acassis avatar Apr 29 '24 20:04 acassis