Skip to content
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

st*spn()-related improvements #1126

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

alejandro-colomar
Copy link
Collaborator

@alejandro-colomar alejandro-colomar commented Nov 16, 2024

Queued after the release of 4.17.0.


Revisions:

v1b
  • Rebase
$ git range-diff alx/master..gh/strrcspn master..strrcspn 
1:  028c489a = 1:  7db0410f lib/string/strchr/: strrcspn(), stprcspn(): Add function and macro
2:  75c38b0b = 2:  becd3bc5 lib/string/strspn/, lib/, src/: Move *spn() APIs to separate subdir
3:  f6095fc7 = 3:  4b7a6f1d lib/string/strspn/, lib/, src/: stprspn(), strrspn_(): Split API into function and macro
4:  293297a2 = 4:  3c73ecc4 lib/basename.c: Basename(): Use stprcspn() instead of its pattern

@alejandro-colomar alejandro-colomar changed the title Add stprcspn(), and use it instead of its pattern *spn()-related improvements Nov 16, 2024
@alejandro-colomar alejandro-colomar changed the title *spn()-related improvements st*spn()-related improvements Nov 16, 2024
@alejandro-colomar alejandro-colomar force-pushed the strrcspn branch 4 times, most recently from c9514aa to ed8f24e Compare December 6, 2024 12:14
@alejandro-colomar alejandro-colomar marked this pull request as ready for review December 22, 2024 12:01
These APIs are to strrspn(), like strcspn() is to strspn().
They are like strcspn(3), but search from the end of the string.

The function is meant for internal use, and consistency with libc.
The macro is meant for normal use, since it returns a pointer,
which is what algorithms using this need.

See also strspn(3) and strcspn(3).

Signed-off-by: Alejandro Colomar <[email protected]>
This provides a better organization.

Signed-off-by: Alejandro Colomar <[email protected]>
… function and macro

This provides a safer and more consistent API.

We had the strrspn(3) function as it was for compatibility with Oracle
Solaris, but let's not repeat their mistake.  Nevertheless, name our
function strrspn_() with a trailing underscore, to differentiate it from
the one in Solaris, since it's slightly different.

Signed-off-by: Alejandro Colomar <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant