-
-
Notifications
You must be signed in to change notification settings - Fork 439
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove VLA #1273
Remove VLA #1273
Conversation
char cpuBrandString[cpuBrandStringSize]; | ||
Platform_getCPUBrandString(cpuBrandString, cpuBrandStringSize); | ||
char cpuBrandString[1024] = ""; | ||
Platform_getCPUBrandString(cpuBrandString, sizeof(cpuBrandString)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Technically not VLA but this change helps readability anyway :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Um, actually … ;-) Although this uses a constant number (which the compiler can deduce), syntactically it iswas.
BTW: I did a grep --color=always -nRP '\b(?!return)\w+ \w+\[[^\]0-9A-Z_]'|less -R
through the source and had a look at the remaining locations found by this. Quite a nice way to quickly get through the source without straight up working with the AST …
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good, thanks for the housekeeping!
This removes various instances of VLA in the code.
The two instances in
RichString.c
(RichString_writeFromWide
&RichString_appendnWideColumns
) have been kept intentionally, for performance reasons AND the alternatives (likealloca
) would be less clear.Those cases aside, I hope I caught all the other instances of VLA in the code.