-
Notifications
You must be signed in to change notification settings - Fork 240
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
[x][v]aprintf(): Add APIs, and use them instead of [x][v]asprintf(3) #1168
Open
alejandro-colomar
wants to merge
9
commits into
shadow-maint:master
Choose a base branch
from
alejandro-colomar:asprintf_
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
[x][v]aprintf(): Add APIs, and use them instead of [x][v]asprintf(3) #1168
alejandro-colomar
wants to merge
9
commits into
shadow-maint:master
from
alejandro-colomar:asprintf_
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
changed the title
[x][v]asprintf_(): Add APIs, and use them
[x][v]asprintf_(): Add APIs, and use them instead of [x][v]asprintf(3)
Jan 1, 2025
alejandro-colomar
force-pushed
the
asprintf_
branch
7 times, most recently
from
January 1, 2025 15:58
8426bbd
to
aaa727a
Compare
alejandro-colomar
force-pushed
the
asprintf_
branch
from
January 2, 2025 02:06
aaa727a
to
cd30ae4
Compare
alejandro-colomar
changed the title
[x][v]asprintf_(): Add APIs, and use them instead of [x][v]asprintf(3)
[x][v]aprintf(): Add APIs, and use them instead of [x][v]asprintf(3)
Jan 2, 2025
alejandro-colomar
force-pushed
the
asprintf_
branch
2 times, most recently
from
January 2, 2025 02:22
d8ac495
to
75c5f3f
Compare
As a curiosity, this aprintf() API seems to be exactly the same that Plan9 calls smprint(3). |
alejandro-colomar
force-pushed
the
asprintf_
branch
4 times, most recently
from
January 6, 2025 02:27
339e14a
to
d46909c
Compare
These functions are just like [v]asprintf(3), but simpler. They return the newly allocated memory, which allows us to use the [[gnu::malloc(free)]] attribute, which enhances static analysis. They also omit the length, which we don't care about at all. As a curiosity, Plan9 seems to provide this same API, under the name smprint(3). Link: <https://9fans.github.io/plan9port/man/man3/print.html> Signed-off-by: Alejandro Colomar <[email protected]>
This is in preparation for the next commit. Signed-off-by: Alejandro Colomar <[email protected]>
Signed-off-by: Alejandro Colomar <[email protected]>
…printf() Wrap [v]aprintf() instead of [v]asprintf(3). Repurpose x[v]asprintf()'s tests to test x[v]aprintf(). Signed-off-by: Alejandro Colomar <[email protected]>
This makes some temporary variables unnecessary. They'll be removed in the next commit. Signed-off-by: Alejandro Colomar <[email protected]>
Signed-off-by: Alejandro Colomar <[email protected]>
…ttern Signed-off-by: Alejandro Colomar <[email protected]>
All these 3 branches have a compatible return value, which we can check at once after the branches. Signed-off-by: Alejandro Colomar <[email protected]>
alejandro-colomar
force-pushed
the
asprintf_
branch
from
January 10, 2025 12:56
d46909c
to
6028771
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.
Cc: @stoeckmann
Revisions:
v2
v2b