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 strtou[l]l_noneg(), as they've been replaced by a2i() calls #895
Draft
alejandro-colomar
wants to merge
9
commits into
shadow-maint:master
Choose a base branch
from
alejandro-colomar:rm_noneg
base: master
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
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.
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
rm_noneg
branch
7 times, most recently
from
January 16, 2024 11:41
c21f32d
to
bce02f8
Compare
alejandro-colomar
force-pushed
the
rm_noneg
branch
from
January 17, 2024 01:29
bce02f8
to
87dfdbd
Compare
alejandro-colomar
changed the title
Remove strtou[l]l_noneg(), as they've been replaced by getlong() variants
Remove strtou[l]l_noneg(), as they've been replaced by a2i() variants
Jan 17, 2024
alejandro-colomar
changed the title
Remove strtou[l]l_noneg(), as they've been replaced by a2i() variants
Remove strtou[l]l_noneg(), as they've been replaced by a2i() calls
Jan 17, 2024
alejandro-colomar
force-pushed
the
rm_noneg
branch
3 times, most recently
from
January 21, 2024 00:40
ccf1910
to
5e0df30
Compare
alejandro-colomar
force-pushed
the
rm_noneg
branch
from
January 29, 2024 15:19
5e0df30
to
143eda5
Compare
alejandro-colomar
force-pushed
the
rm_noneg
branch
from
February 6, 2024 01:20
143eda5
to
d86f557
Compare
alejandro-colomar
force-pushed
the
rm_noneg
branch
2 times, most recently
from
February 20, 2024 00:08
9391bf2
to
4015fd5
Compare
alejandro-colomar
force-pushed
the
rm_noneg
branch
3 times, most recently
from
March 15, 2024 00:56
b23f9c0
to
4c75179
Compare
v2 changes:
|
alejandro-colomar
force-pushed
the
rm_noneg
branch
from
March 21, 2024 14:29
4c75179
to
096cce6
Compare
v2b changes:
|
alejandro-colomar
force-pushed
the
rm_noneg
branch
from
March 23, 2024 23:30
096cce6
to
8fb1abf
Compare
v2c changes:
|
alejandro-colomar
force-pushed
the
rm_noneg
branch
from
March 29, 2024 19:39
8fb1abf
to
07e26fe
Compare
v2d changes:
|
alejandro-colomar
force-pushed
the
rm_noneg
branch
from
April 16, 2024 01:57
07e26fe
to
eb1290d
Compare
v2e changes:
|
This comment was marked as resolved.
This comment was marked as resolved.
alejandro-colomar
force-pushed
the
rm_noneg
branch
from
April 16, 2024 13:51
eb1290d
to
857f2e9
Compare
v2f changes:
|
These overloaded macros allow passing either a const or a non-const endp, and will call the appropriate function. This kind of const overloading has prior art in C23's string functions, such as memchr(3). Martin suggested using an artificial function pointer in _Generic(3); it allows switching on various types at the same time. Link: <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3096.pdf#subsubsection.7.26.5.2> Link: <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114731> Co-developed-by: Martin Uecker <muecker@gwdg.de> Signed-off-by: Alejandro Colomar <alx@kernel.org>
It simplifies the error checking. Signed-off-by: Alejandro Colomar <alx@kernel.org>
Now that we have const-generic macros, we can use a const pointer. Signed-off-by: Alejandro Colomar <alx@kernel.org>
isdigit(3) requires a cast if the argument is of type 'char'. Signed-off-by: Alejandro Colomar <alx@kernel.org>
Cc: Serge Hallyn <serge@hallyn.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
time_t isn't necessarily unsigned (in fact, it's likely to be signed. Therefore, parse the number as the right type, via a2i(time_t, ...). Still, reject negative numbers, just to be cautious. It was done before (strtoull_noneg()), so it shouldn't be a problem. (However, strtoull_noneg() was only introduced recently, and before that we called strtoull(3), which silently accepted negative values.) Remove the limitation of ULONG_MAX, which seems arbitrary. It probably was written in times where 'time_t' had the same length of 'long', and this was thus a test that the value didn't overflow 'time_t'. Such a test is implicit in the a2i() call, so forget about it. Unify the error messages into a single one that provides all the info (except the value of 'fallback'). Link: <shadow-maint@cb610d5#r136407772> Cc: Chris Lamb <lamby@debian.org> Cc: Serge Hallyn <serge@hallyn.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
…unction All call sites were replaced by a2i() recently. Signed-off-by: Alejandro Colomar <alx@kernel.org>
It is a simpler call, with more type safety. A consequence of this change is that the program now accepts numbers in bases 8 and 16. That's not a problem here, I think. Signed-off-by: Alejandro Colomar <alx@kernel.org>
…nction All call sites have been replaced by functions from "atoi/a2i.h" and "atoi/str2i.h" recently. Signed-off-by: Alejandro Colomar <alx@kernel.org>
alejandro-colomar
force-pushed
the
rm_noneg
branch
from
May 5, 2024 22:17
857f2e9
to
80ad37b
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.
Revisions:
v3
v3 changes: