-
Notifications
You must be signed in to change notification settings - Fork 235
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
Expunge strtoll(3) and strtol(3) #896
Merged
alejandro-colomar
merged 16 commits into
shadow-maint:master
from
alejandro-colomar:strtoll
Jun 29, 2024
Merged
Expunge strtoll(3) and strtol(3) #896
alejandro-colomar
merged 16 commits into
shadow-maint:master
from
alejandro-colomar:strtoll
Jun 29, 2024
Conversation
This file contains 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
alejandro-colomar
force-pushed
the
strtoll
branch
14 times, most recently
from
January 16, 2024 13:51
69b1fca
to
ff5452a
Compare
alejandro-colomar
force-pushed
the
strtoll
branch
4 times, most recently
from
January 21, 2024 00:40
2a6b341
to
5e9fdf4
Compare
alejandro-colomar
force-pushed
the
strtoll
branch
from
January 29, 2024 15:19
5e9fdf4
to
828ea1f
Compare
alejandro-colomar
force-pushed
the
strtoll
branch
from
February 6, 2024 01:20
828ea1f
to
c756605
Compare
alejandro-colomar
force-pushed
the
strtoll
branch
2 times, most recently
from
February 20, 2024 00:08
a73bd21
to
05152cc
Compare
alejandro-colomar
force-pushed
the
strtoll
branch
3 times, most recently
from
March 15, 2024 00:55
68ba703
to
a0b322e
Compare
v2 changes:
|
alejandro-colomar
force-pushed
the
strtoll
branch
from
March 21, 2024 14:28
a0b322e
to
97d5ce5
Compare
v2b changes:
|
alejandro-colomar
force-pushed
the
strtoll
branch
from
June 14, 2024 10:33
b85ad7a
to
8ee58c1
Compare
hallyn
reviewed
Jun 29, 2024
hallyn
reviewed
Jun 29, 2024
hallyn
approved these changes
Jun 29, 2024
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.
Thank you, this is great.
Feel free to merge as is, or if you want to add a testcase for the type_min/max, that's great too.
In the case of is_unsigned() and is_signed(), the natural thing would be to compare to 0: #define is_unsigned(x) (((typeof(x)) -1) > 0) #define is_signed(x) (((typeof(x)) -1) < 0) However, that would trigger -Wtype-limits, so we compare against 1, which silences that, and does the same job. Signed-off-by: Alejandro Colomar <alx@kernel.org>
Suggested-by: "Serge E. Hallyn" <serge@hallyn.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
alejandro-colomar
force-pushed
the
strtoll
branch
from
June 29, 2024 17:36
8ee58c1
to
5aab832
Compare
On Sat, Jun 29, 2024 at 10:16:16AM GMT, Serge Hallyn wrote:
@hallyn approved this pull request.
Thank you, this is great.
Feel free to merge as is, or if you want to add a testcase for the type_min/max, that's great too.
I've added your suggestions, plus some readability improvements (v5; see first comment).
I'll add your reviewed-by for all commits, if you confirm.
Thanks!
Have a lovely day!
Alex
… --
Reply to this email directly or view it on GitHub:
#896 (review)
You are receiving this because you authored the thread.
Message ID: ***@***.***>
|
atoi(3) easily triggers Undefined Behavior. Replace it by str2[u]l(), which are safe from that, and add type safety too. Reviewed-by: "Serge E. Hallyn" <serge@hallyn.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
Reviewed-by: "Serge E. Hallyn" <serge@hallyn.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
Implement it as an inline function, and add restrict and ATTR_STRING() and ATTR_ACCESS() as appropriate. Reviewed-by: "Serge E. Hallyn" <serge@hallyn.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
These functions were open-coding get_gid(). Use the actual function. Reviewed-by: "Serge E. Hallyn" <serge@hallyn.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
Reviewed-by: "Serge E. Hallyn" <serge@hallyn.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
Implement it as an inline function, and add restrict and ATTR_STRING() and ATTR_ACCESS() as appropriate. Reviewed-by: "Serge E. Hallyn" <serge@hallyn.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
…iptor from a string Reviewed-by: "Serge E. Hallyn" <serge@hallyn.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
Reviewed-by: "Serge E. Hallyn" <serge@hallyn.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
Reviewed-by: "Serge E. Hallyn" <serge@hallyn.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
Reviewed-by: "Serge E. Hallyn" <serge@hallyn.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
Implement it as an inline function, and add restrict and ATTR_STRING() and ATTR_ACCESS() as appropriate. Reviewed-by: "Serge E. Hallyn" <serge@hallyn.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
Reviewed-by: "Serge E. Hallyn" <serge@hallyn.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
Now that we use liba2i's const-generic macros, we can (and must) use a 'const char **' endp where the input string is 'const char *'. Reviewed-by: "Serge E. Hallyn" <serge@hallyn.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
Suggested-by: "Serge E. Hallyn" <serge@hallyn.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
alejandro-colomar
force-pushed
the
strtoll
branch
from
June 29, 2024 17:46
5aab832
to
ee723b5
Compare
Awesome - thank you. |
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.
Remove all calls to strtoll(3) and strtol(3), and replace them by safer calls like getlong() or getnum().
Revisions
v3
v3 changes:v4
v4 changes:v4b
v4c
v4d
v5
v5b