-
Notifications
You must be signed in to change notification settings - Fork 254
[x][v]aprintf(): Add APIs, and use them instead of [x][v]asprintf(3) #1168
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
Conversation
8426bbd to
aaa727a
Compare
aaa727a to
cd30ae4
Compare
d8ac495 to
75c5f3f
Compare
|
As a curiosity, this aprintf() API seems to be exactly the same that Plan9 calls smprint(3). |
339e14a to
d46909c
Compare
d46909c to
6028771
Compare
f754321 to
fb328c9
Compare
fb328c9 to
b76ee5d
Compare
ac14346 to
932734c
Compare
932734c to
ed62940
Compare
ed62940 to
9891bea
Compare
9891bea to
5ca167e
Compare
|
This API has been discussed in the C Committee for inclusion in C2y, and there seems to be interest in the API. Here's a draft of a proposal, which will probably be voted in the next committee meeting (2025-08): https://www.alejandro-colomar.es/src/alx/alx/wg14/alx-0007.git/tree/alx-0007.txt. |
750d34b to
0d67f96
Compare
|
@hallyn Thanks for your time and work reviewing and merging stuff! I've finished rebasing everything of mine after the recent merges, so feel free to continue reviewing and merging. :) |
86a4282 to
742660a
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 <alx@kernel.org>
This is in preparation for the next commit. Signed-off-by: Alejandro Colomar <alx@kernel.org>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
…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 <alx@kernel.org>
This makes some temporary variables unnecessary. They'll be removed in the next commit. Signed-off-by: Alejandro Colomar <alx@kernel.org>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
…ttern Signed-off-by: Alejandro Colomar <alx@kernel.org>
All these 3 branches have a compatible return value, which we can check at once after the branches. Signed-off-by: Alejandro Colomar <alx@kernel.org>
742660a to
2793870
Compare
Cc: @stoeckmann
Revisions:
v2
v2b
v2c
v2d
v2e
v2f
v3
v3b
v3c
v3d
v3e
v3f
v3g
v3h
v3i
v3j
v3k
v3l