Skip to content

Commit f3b36f3

Browse files
committed
fix: non_upper_case_globals check after previous commit
1 parent f4e8486 commit f3b36f3

File tree

6 files changed

+28
-20
lines changed

6 files changed

+28
-20
lines changed

examples/async.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ impl Default for ModuleConfig {
5454
}
5555
}
5656

57-
static mut ngx_http_async_commands: [ngx_command_t; 2] = [
57+
static mut NGX_HTTP_ASYNC_COMMANDS: [ngx_command_t; 2] = [
5858
ngx_command_t {
5959
name: ngx_string!("async"),
6060
type_: (NGX_HTTP_LOC_CONF | NGX_CONF_TAKE1) as ngx_uint_t,
@@ -66,7 +66,7 @@ static mut ngx_http_async_commands: [ngx_command_t; 2] = [
6666
ngx_null_command!(),
6767
];
6868

69-
static ngx_http_async_module_ctx: ngx_http_module_t = ngx_http_module_t {
69+
static NGX_HTTP_ASYNC_MODULE_CTX: ngx_http_module_t = ngx_http_module_t {
7070
preconfiguration: Some(Module::preconfiguration),
7171
postconfiguration: Some(Module::postconfiguration),
7272
create_main_conf: Some(Module::create_main_conf),
@@ -83,6 +83,7 @@ static ngx_http_async_module_ctx: ngx_http_module_t = ngx_http_module_t {
8383
ngx::ngx_modules!(ngx_http_async_module);
8484

8585
#[used]
86+
#[allow(non_upper_case_globals)]
8687
#[cfg_attr(not(feature = "export-modules"), no_mangle)]
8788
pub static mut ngx_http_async_module: ngx_module_t = ngx_module_t {
8889
ctx_index: ngx_uint_t::MAX,
@@ -93,8 +94,8 @@ pub static mut ngx_http_async_module: ngx_module_t = ngx_module_t {
9394
version: nginx_version as ngx_uint_t,
9495
signature: NGX_RS_MODULE_SIGNATURE.as_ptr() as *const c_char,
9596

96-
ctx: &ngx_http_async_module_ctx as *const _ as *mut _,
97-
commands: unsafe { &ngx_http_async_commands[0] as *const _ as *mut _ },
97+
ctx: &NGX_HTTP_ASYNC_MODULE_CTX as *const _ as *mut _,
98+
commands: unsafe { &NGX_HTTP_ASYNC_COMMANDS[0] as *const _ as *mut _ },
9899
type_: NGX_HTTP_MODULE as ngx_uint_t,
99100

100101
init_master: None,

examples/awssig.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ struct ModuleConfig {
4242
s3_endpoint: String,
4343
}
4444

45-
static mut ngx_http_awssigv4_commands: [ngx_command_t; 6] = [
45+
static mut NGX_HTTP_AWSSIGV4_COMMANDS: [ngx_command_t; 6] = [
4646
ngx_command_t {
4747
name: ngx_string!("awssigv4"),
4848
type_: (NGX_HTTP_LOC_CONF | NGX_HTTP_SRV_CONF | NGX_CONF_TAKE1) as ngx_uint_t,
@@ -86,7 +86,7 @@ static mut ngx_http_awssigv4_commands: [ngx_command_t; 6] = [
8686
ngx_null_command!(),
8787
];
8888

89-
static ngx_http_awssigv4_module_ctx: ngx_http_module_t = ngx_http_module_t {
89+
static NGX_HTTP_AWSSIGV4_MODULE_CTX: ngx_http_module_t = ngx_http_module_t {
9090
preconfiguration: Some(Module::preconfiguration),
9191
postconfiguration: Some(Module::postconfiguration),
9292
create_main_conf: Some(Module::create_main_conf),
@@ -103,6 +103,7 @@ static ngx_http_awssigv4_module_ctx: ngx_http_module_t = ngx_http_module_t {
103103
ngx::ngx_modules!(ngx_http_awssigv4_module);
104104

105105
#[used]
106+
#[allow(non_upper_case_globals)]
106107
#[cfg_attr(not(feature = "export-modules"), no_mangle)]
107108
pub static mut ngx_http_awssigv4_module: ngx_module_t = ngx_module_t {
108109
ctx_index: ngx_uint_t::MAX,
@@ -113,8 +114,8 @@ pub static mut ngx_http_awssigv4_module: ngx_module_t = ngx_module_t {
113114
version: nginx_version as ngx_uint_t,
114115
signature: NGX_RS_MODULE_SIGNATURE.as_ptr() as *const c_char,
115116

116-
ctx: &ngx_http_awssigv4_module_ctx as *const _ as *mut _,
117-
commands: unsafe { &ngx_http_awssigv4_commands[0] as *const _ as *mut _ },
117+
ctx: &NGX_HTTP_AWSSIGV4_MODULE_CTX as *const _ as *mut _,
118+
commands: unsafe { &NGX_HTTP_AWSSIGV4_COMMANDS[0] as *const _ as *mut _ },
118119
type_: NGX_HTTP_MODULE as ngx_uint_t,
119120

120121
init_master: None,

examples/curl.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ struct ModuleConfig {
3636
enable: bool,
3737
}
3838

39-
static mut ngx_http_curl_commands: [ngx_command_t; 2] = [
39+
static mut NGX_HTTP_CURL_COMMANDS: [ngx_command_t; 2] = [
4040
ngx_command_t {
4141
name: ngx_string!("curl"),
4242
type_: (NGX_HTTP_LOC_CONF | NGX_CONF_TAKE1) as ngx_uint_t,
@@ -48,7 +48,7 @@ static mut ngx_http_curl_commands: [ngx_command_t; 2] = [
4848
ngx_null_command!(),
4949
];
5050

51-
static ngx_http_curl_module_ctx: ngx_http_module_t = ngx_http_module_t {
51+
static NGX_HTTP_CURL_MODULE_CTX: ngx_http_module_t = ngx_http_module_t {
5252
preconfiguration: Some(Module::preconfiguration),
5353
postconfiguration: Some(Module::postconfiguration),
5454
create_main_conf: Some(Module::create_main_conf),
@@ -65,6 +65,7 @@ static ngx_http_curl_module_ctx: ngx_http_module_t = ngx_http_module_t {
6565
ngx::ngx_modules!(ngx_http_curl_module);
6666

6767
#[used]
68+
#[allow(non_upper_case_globals)]
6869
#[cfg_attr(not(feature = "export-modules"), no_mangle)]
6970
pub static mut ngx_http_curl_module: ngx_module_t = ngx_module_t {
7071
ctx_index: ngx_uint_t::MAX,
@@ -75,8 +76,8 @@ pub static mut ngx_http_curl_module: ngx_module_t = ngx_module_t {
7576
version: nginx_version as ngx_uint_t,
7677
signature: NGX_RS_MODULE_SIGNATURE.as_ptr() as *const c_char,
7778

78-
ctx: &ngx_http_curl_module_ctx as *const _ as *mut _,
79-
commands: unsafe { &ngx_http_curl_commands[0] as *const _ as *mut _ },
79+
ctx: &NGX_HTTP_CURL_MODULE_CTX as *const _ as *mut _,
80+
commands: unsafe { &NGX_HTTP_CURL_COMMANDS[0] as *const _ as *mut _ },
8081
type_: NGX_HTTP_MODULE as ngx_uint_t,
8182

8283
init_master: None,

examples/httporigdst.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ impl NgxHttpOrigDstCtx {
7676
}
7777
}
7878

79-
static ngx_http_orig_dst_module_ctx: ngx_http_module_t = ngx_http_module_t {
79+
static NGX_HTTP_ORIG_DST_MODULE_CTX: ngx_http_module_t = ngx_http_module_t {
8080
preconfiguration: Some(Module::preconfiguration),
8181
postconfiguration: Some(Module::postconfiguration),
8282
create_main_conf: Some(Module::create_main_conf),
@@ -93,6 +93,7 @@ static ngx_http_orig_dst_module_ctx: ngx_http_module_t = ngx_http_module_t {
9393
ngx::ngx_modules!(ngx_http_orig_dst_module);
9494

9595
#[used]
96+
#[allow(non_upper_case_globals)]
9697
#[cfg_attr(not(feature = "export-modules"), no_mangle)]
9798
pub static mut ngx_http_orig_dst_module: ngx_module_t = ngx_module_t {
9899
ctx_index: ngx_uint_t::MAX,
@@ -102,7 +103,7 @@ pub static mut ngx_http_orig_dst_module: ngx_module_t = ngx_module_t {
102103
spare1: 0,
103104
version: nginx_version as ngx_uint_t,
104105
signature: NGX_RS_MODULE_SIGNATURE.as_ptr() as *const c_char,
105-
ctx: &ngx_http_orig_dst_module_ctx as *const _ as *mut _,
106+
ctx: &NGX_HTTP_ORIG_DST_MODULE_CTX as *const _ as *mut _,
106107
commands: std::ptr::null_mut(),
107108
type_: NGX_HTTP_MODULE as ngx_uint_t,
108109

@@ -124,7 +125,7 @@ pub static mut ngx_http_orig_dst_module: ngx_module_t = ngx_module_t {
124125
spare_hook7: 0,
125126
};
126127

127-
static mut ngx_http_orig_dst_vars: [ngx_http_variable_t; 3] = [
128+
static mut NGX_HTTP_ORIG_DST_VARS: [ngx_http_variable_t; 3] = [
128129
// ngx_str_t name
129130
// ngx_http_set_variable_pt set_handler
130131
// ngx_http_get_variable_pt get_handler
@@ -297,7 +298,7 @@ impl HTTPModule for Module {
297298

298299
// static ngx_int_t ngx_http_orig_dst_add_variables(ngx_conf_t *cf)
299300
unsafe extern "C" fn preconfiguration(cf: *mut ngx_conf_t) -> ngx_int_t {
300-
for mut v in ngx_http_orig_dst_vars {
301+
for mut v in NGX_HTTP_ORIG_DST_VARS {
301302
if v.name.len == 0 {
302303
break;
303304
}

examples/upstream.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ impl Default for UpstreamPeerData {
7676
}
7777
}
7878

79-
static ngx_http_upstream_custom_ctx: ngx_http_module_t = ngx_http_module_t {
79+
static NGX_HTTP_UPSTREAM_CUSTOM_CTX: ngx_http_module_t = ngx_http_module_t {
8080
preconfiguration: Some(Module::preconfiguration),
8181
postconfiguration: Some(Module::postconfiguration),
8282
create_main_conf: Some(Module::create_main_conf),
@@ -87,7 +87,7 @@ static ngx_http_upstream_custom_ctx: ngx_http_module_t = ngx_http_module_t {
8787
merge_loc_conf: Some(Module::merge_loc_conf),
8888
};
8989

90-
static mut ngx_http_upstream_custom_commands: [ngx_command_t; 2] = [
90+
static mut NGX_HTTP_UPSTREAM_CUSTOM_COMMANDS: [ngx_command_t; 2] = [
9191
ngx_command_t {
9292
name: ngx_string!("custom"),
9393
type_: (NGX_HTTP_UPS_CONF | NGX_CONF_NOARGS | NGX_CONF_TAKE1) as ngx_uint_t,
@@ -105,6 +105,7 @@ static mut ngx_http_upstream_custom_commands: [ngx_command_t; 2] = [
105105
ngx::ngx_modules!(ngx_http_upstream_custom_module);
106106

107107
#[used]
108+
#[allow(non_upper_case_globals)]
108109
#[cfg_attr(not(feature = "export-modules"), no_mangle)]
109110
pub static mut ngx_http_upstream_custom_module: ngx_module_t = ngx_module_t {
110111
ctx_index: ngx_uint_t::MAX,
@@ -115,8 +116,8 @@ pub static mut ngx_http_upstream_custom_module: ngx_module_t = ngx_module_t {
115116
version: nginx_version as ngx_uint_t,
116117
signature: NGX_RS_MODULE_SIGNATURE.as_ptr() as *const c_char,
117118

118-
ctx: &ngx_http_upstream_custom_ctx as *const _ as *mut _,
119-
commands: unsafe { &ngx_http_upstream_custom_commands[0] as *const _ as *mut _ },
119+
ctx: &NGX_HTTP_UPSTREAM_CUSTOM_CTX as *const _ as *mut _,
120+
commands: unsafe { &NGX_HTTP_UPSTREAM_CUSTOM_COMMANDS[0] as *const _ as *mut _ },
120121
type_: NGX_HTTP_MODULE as ngx_uint_t,
121122

122123
init_master: None,

src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,18 +64,21 @@ pub mod log;
6464
macro_rules! ngx_modules {
6565
($( $mod:ident ),+) => {
6666
#[no_mangle]
67+
#[allow(non_upper_case_globals)]
6768
pub static mut ngx_modules: [*const $crate::ffi::ngx_module_t; $crate::count!($( $mod, )+) + 1] = [
6869
$( unsafe { &$mod } as *const $crate::ffi::ngx_module_t, )+
6970
::std::ptr::null()
7071
];
7172

7273
#[no_mangle]
74+
#[allow(non_upper_case_globals)]
7375
pub static mut ngx_module_names: [*const ::std::ffi::c_char; $crate::count!($( $mod, )+) + 1] = [
7476
$( concat!(stringify!($mod), "\0").as_ptr() as *const ::std::ffi::c_char, )+
7577
::std::ptr::null()
7678
];
7779

7880
#[no_mangle]
81+
#[allow(non_upper_case_globals)]
7982
pub static mut ngx_module_order: [*const ::std::ffi::c_char; 1] = [
8083
::std::ptr::null()
8184
];

0 commit comments

Comments
 (0)