Skip to content

Commit 52fae5c

Browse files
Use configuration tags instead of features for flags (#59)
e.g. PHP debug or ZTS mode are no longer features, but just simply configuration flags.
1 parent 20e8c16 commit 52fae5c

File tree

4 files changed

+8
-11
lines changed

4 files changed

+8
-11
lines changed

Cargo.toml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@ regex = "1"
2020
cc = "1.0.67"
2121

2222
[features]
23-
zts = []
24-
debug = []
25-
2623
alloc = []
2724
closure = []
2825

build.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,11 +124,11 @@ fn main() {
124124
let configure = Configure::get();
125125

126126
if configure.has_zts() {
127-
println!("cargo:rustc-cfg=feature=\"zts\"");
127+
println!("cargo:rustc-cfg=php_zts");
128128
}
129129

130130
if configure.debug() {
131-
println!("cargo:rustc-cfg=feature=\"debug\"");
131+
println!("cargo:rustc-cfg=php_debug");
132132
}
133133
}
134134

src/php/alloc.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ pub fn emalloc(layout: Layout) -> *mut u8 {
1717
let size = layout.size();
1818

1919
(unsafe {
20-
#[cfg(feature = "debug")]
20+
#[cfg(php_debug)]
2121
{
2222
_emalloc(size as _, std::ptr::null_mut(), 0, std::ptr::null_mut(), 0)
2323
}
24-
#[cfg(not(feature = "debug"))]
24+
#[cfg(not(php_debug))]
2525
{
2626
_emalloc(size as _)
2727
}
@@ -39,7 +39,7 @@ pub fn emalloc(layout: Layout) -> *mut u8 {
3939
/// Caller must guarantee that the given pointer is valid (aligned and non-null) and
4040
/// was originally allocated through the Zend memory manager.
4141
pub unsafe fn efree(ptr: *mut u8) {
42-
#[cfg(feature = "debug")]
42+
#[cfg(php_debug)]
4343
{
4444
_efree(
4545
ptr as *mut c_void,
@@ -49,7 +49,7 @@ pub unsafe fn efree(ptr: *mut u8) {
4949
0,
5050
)
5151
}
52-
#[cfg(not(feature = "debug"))]
52+
#[cfg(not(php_debug))]
5353
{
5454
_efree(ptr as *mut c_void)
5555
}

src/php/module.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,9 @@ impl ModuleBuilder {
8181
info_func: None,
8282
version: ptr::null(),
8383
globals_size: 0,
84-
#[cfg(not(feature = "zts"))]
84+
#[cfg(not(php_zts))]
8585
globals_ptr: ptr::null::<c_void>() as *mut c_void,
86-
#[cfg(feature = "zts")]
86+
#[cfg(php_zts)]
8787
globals_id_ptr: ptr::null::<c_void>() as *mut crate::bindings::ts_rsrc_id,
8888
globals_ctor: None,
8989
globals_dtor: None,

0 commit comments

Comments
 (0)