-
Notifications
You must be signed in to change notification settings - Fork 252
lib/: Some improvements to sizes of array parameters #1134
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
Open
alejandro-colomar
wants to merge
4
commits into
shadow-maint:master
Choose a base branch
from
alejandro-colomar:arrayparam
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
lib/: Some improvements to sizes of array parameters #1134
alejandro-colomar
wants to merge
4
commits into
shadow-maint:master
from
alejandro-colomar:arrayparam
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Closed
839aa80 to
fea5bcf
Compare
|
Queued after the release of 4.17.0. |
fea5bcf to
40bd936
Compare
40bd936 to
91af1e4
Compare
133e9cc to
b0589f7
Compare
b0589f7 to
087d85e
Compare
94a7203 to
34c2c09
Compare
34c2c09 to
dc7167f
Compare
dc7167f to
0926e79
Compare
0926e79 to
31afd7d
Compare
10dad35 to
88778fd
Compare
d2a0110 to
6ec4643
Compare
254206e to
69d4db2
Compare
69d4db2 to
1b6eedc
Compare
ba4ee38 to
76a7a61
Compare
37e3e7b to
e23d3d1
Compare
| inline char * | ||
| stpeprintf(char *dst, char *end, const char *restrict fmt, ...) | ||
| stpeprintf(char *dst, char *end; | ||
| char dst[dst ? end - dst : 0], char end[0], const char *restrict fmt, ...) |
Check notice
Code scanning / CodeQL
Short global name Note
Poor global variable name 'dst'. Prefer longer, descriptive names for globals (eg. kMyGlobalConstant, not foo).
| inline char * | ||
| stpecpy(char *dst, char *end, const char *restrict src) | ||
| stpecpy(char *dst, char *end; | ||
| char dst[dst ? end - dst : 0], char end[0], const char *restrict src) |
Check notice
Code scanning / CodeQL
Short global name Note
Poor global variable name 'dst'. Prefer longer, descriptive names for globals (eg. kMyGlobalConstant, not foo).
e23d3d1 to
7f95395
Compare
9c468a5 to
daf2521
Compare
daf2521 to
79d59a1
Compare
79d59a1 to
bc4d815
Compare
'n' is just as meaningful as 'nmemb', and is in more common use in C projects (including this one). Signed-off-by: Alejandro Colomar <[email protected]>
GNU C has an extension which allows to forward-declare parameters, so that array notation can be used with sizes that are defined after the array itself. This improves the safety of such arrays, by telling the compiler the bounds of the array. This feature has been proposed for standardization in C2y as n3394. Link: n3394 <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3394.pdf> Cc: Martin Uecker <[email protected]> Signed-off-by: Alejandro Colomar <[email protected]>
Link: n3394 <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3394.pdf> Signed-off-by: Alejandro Colomar <[email protected]>
Signed-off-by: Alejandro Colomar <[email protected]>
bc4d815 to
747d09c
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The first commit is just readability stuff, but the second one is an important safety improvement.
Cc: @uecker
Revisions:
v1b
v1c
v1d
v1e
v1f
v1g
v1h
v1i
v1j
v2
v2b
v2c
v2d
v2e
v2f
v2g
v2h
v2i
v2j
v2k
v2l
v2m
v2n
v3
v3b
v3c
v3d
v4
v4b
v4c
v5
v6
v6b
v6c
v6d
v6e
v6f