-
Notifications
You must be signed in to change notification settings - Fork 707
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
refactor: move s2n_result functions inline #4739
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't really see any downside to this change, but do you have any data on the performance benefits?
/* | ||
* The goal of s2n_result is to provide a strongly-typed error | ||
* signal value, which provides the compiler with enough information |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: I think we generally put big comments like this after the includes, rather than before? But idk, we don't have many examples :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure i agree with that convention. Why wouldn't the module-level documentation be the first thing, since it's the first thing you read to understand why the module exists? Why would includes be first?
Not offhand but I can try to get some if you'd like, though it may take a bit of effort. Actually, the reason I'm making this change now is to simplify the fuzz test work that @jouho is working on - we were running into issues building the LD_PRELOAD |
Description of changes:
This change moves all of the
s2n_result
functions into thes2n_result.h
file. All of these functions consist of a single expression and prevent potential optimizations without LTO being enabled. All of these functions arestatic inline
to avoid duplicate symbols.Testing:
Since this is a simple refactor, no additional testing is needed.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.