-
Notifications
You must be signed in to change notification settings - Fork 241
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 #868
Closed
Closed
X #868
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
a71f59a
to
34b251f
Compare
af2c612
to
b026680
Compare
And move some from "must_be.h" to the new header "typetraits.h", and reimplement them in terms of the new macros. Signed-off-by: Alejandro Colomar <[email protected]>
Writing an x*() variant of several functions is unnecessary. It's simpler to write a generic x() macro that can be chained with any other calls. For example: - x(malloc(...)) instead of xmalloc(...); - x(strdup(...)) instead of xstrdup(...); This requires that we use a very strict and consistent convention of signaling errors. For pointers, the obvious way is NULL. For integers, it's -1. If an error is detected, log an error, and exit(13). About why 13, I don't really know. It's just what was used previously in xmalloc(). Signed-off-by: Alejandro Colomar <[email protected]>
Signed-off-by: Alejandro Colomar <[email protected]>
Signed-off-by: Alejandro Colomar <[email protected]>
Signed-off-by: Alejandro Colomar <[email protected]>
Signed-off-by: Alejandro Colomar <[email protected]>
Signed-off-by: Alejandro Colomar <[email protected]>
…se its test to test now x() Signed-off-by: Alejandro Colomar <[email protected]>
Link: <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107348> 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
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.
Not Twitter. The other x.
Continuing the series of generalizing APIs and reducing specialized functions, kill all x*() functions, and add a generic x() macro that can be chained to any "standard" call, that is, any call that reports errors via
-1
(for integers) orNULL
(for pointers).Instead of
xasprintf()
, now we'llx(asprintf())
. Instead ofxstrdup()
,x(strdup())
.