-
Notifications
You must be signed in to change notification settings - Fork 254
lib/: Add ispfchar(), and use it instead of its pattern #1469
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
Draft
alejandro-colomar
wants to merge
13
commits into
shadow-maint:master
Choose a base branch
from
alejandro-colomar:chkname
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.
+160
−194
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
f97b10f to
1ead5c6
Compare
8fd9e48 to
d39008c
Compare
stoeckmann
suggested changes
Jan 2, 2026
These are like the isascii(3) family of APIs, but use the C locale, as the _c suffix hints. These macros behave well with non-casted input, unlike isascii(3). The isascii_c() and iscntrl_c() implementations are different from the rest because they must return true for '\0'. Reported-by: Tobias Stoeckmann <tobias@stoeckmann.org> Cc: Paul Eggert <eggert@cs.ucla.edu> Signed-off-by: Alejandro Colomar <alx@kernel.org>
We want to use the C locale. Reported-by: Tobias Stoeckmann <tobias@stoeckmann.org> Signed-off-by: Alejandro Colomar <alx@kernel.org>
The APIs defined under each of those subdirs are too similar and related that it makes more sense to define them in the same files. (BTW, we only had one API per subdir, except in one subdir that had two APIs, so in the end, we have almost the same separation.) Signed-off-by: Alejandro Colomar <alx@kernel.org>
This also makes it consistent with strisdigit(). Signed-off-by: Alejandro Colomar <alx@kernel.org>
By being closer together, I find them more readable. The pattern and the differences are easier to spot. Signed-off-by: Alejandro Colomar <alx@kernel.org>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
This compacts it into a one-liner, more similar to the strisascii_c() functions. Since we only use the argument once, we can even turn this into a macro. Signed-off-by: Alejandro Colomar <alx@kernel.org>
This allows us to not depend on whether strisprint_c("") returns true or
false.
Signed-off-by: Alejandro Colomar <alx@kernel.org>
d39008c to
1cabaf3
Compare
It is not intuitive or clear what the right behavior should be for an empty string. If we define these APIs as "return true if all characters in the string belong to the specified character set", then an empty string should return true. On the other hand, if you ask me if an empty string is a numeric string, I might naively say no. It is irrelevant whether we return true or false for an empty string. All of the callers already handle correctly the case of an empty string. This makes the implementation simpler, using the argument only once. This allows implementing these as macros. Signed-off-by: Alejandro Colomar <alx@kernel.org>
1cabaf3 to
e371b46
Compare
This function returns true if the input character is a character from the POSIX portable filename character set. Link: <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/V1_chap03.html#tag_03_265> Signed-off-by: Alejandro Colomar <alx@kernel.org>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
In the first case, we can do the transformation because a few lines above, we explicitly reject a name starting with a '-'. In the second case, we're obviously using ispfchar_c() instead of its pattern. Signed-off-by: Alejandro Colomar <alx@kernel.org>
e371b46 to
000c8c1
Compare
stoeckmann
previously requested changes
Jan 3, 2026
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:
v2
v2b
v3
v3b
v3c