-
Notifications
You must be signed in to change notification settings - Fork 63
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
chore: reduce boilerplate code for ngx_module_t declarations #117
base: master
Are you sure you want to change the base?
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.
Still not convinced the commands initialization change is right. It assumes constness where we shouldn't, and could be less readable with a larger set of commands.
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.
ngx_module_t::default
and CONF_OFFSET
changes look good. I'm ready to cherry-pick these to master if you split the CONF_OFFSET patch and reorder both before the prelude one,
I have reservations about the prelude patch though. Maybe we need more high-level wrappers before introducing this.
Note: refactor!:
prefix to the commit summaries seems more fitting. See https://www.conventionalcommits.org/en/v1.0.0/#summary and https://github.com/angular/angular/blob/22b96b9/CONTRIBUTING.md#-commit-message-guidelines
/// The offset of the `main_conf` field in the `ngx_http_conf_ctx_t` struct. | ||
/// | ||
/// This is used to access the main configuration context for an HTTP module. | ||
pub const NGX_HTTP_MAIN_CONF_OFFSET: usize = offset_of!(ngx_http_conf_ctx_t, main_conf); |
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.
Can you please split this change into a separate commit?
spare0: 0, | ||
spare1: 0, | ||
version: nginx_version as ngx_uint_t, | ||
signature: NGX_RS_MODULE_SIGNATURE.as_ptr() as *const core::ffi::c_char, |
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.
NGX_RS_MODULE_SIGNATURE.as_ptr()
already returns *const c_char
, the cast seems redundant.
This partially addresses #107.