Skip to content

Commit 406a6a8

Browse files
vanhauser-thcsmoelius
authored andcommitted
fix
1 parent b24db9c commit 406a6a8

File tree

1 file changed

+40
-28
lines changed

1 file changed

+40
-28
lines changed

afl/src/lib.rs

Lines changed: 40 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -42,48 +42,56 @@ unsafe extern "C" {
4242
#[macro_export]
4343
macro_rules! ijon_inc {
4444
($x:expr) => {{
45-
static mut loc: u32 = 0;
46-
if loc == 0 {
47-
let cfile = std::ffi::CString::new(file!()).unwrap();
48-
loc = unsafe { ijon_hashstr(line!(), cfile.as_ptr()) };
49-
}
50-
unsafe { ijon_inc(loc, $x) };
45+
unsafe {
46+
static mut loc: u32 = 0;
47+
if loc == 0 {
48+
let cfile = std::ffi::CString::new(file!()).unwrap();
49+
loc = ijon_hashstr(line!(), cfile.as_ptr());
50+
}
51+
ijon_inc(loc, $x)
52+
};
5153
}};
5254
}
5355

5456
#[macro_export]
5557
macro_rules! ijon_max {
5658
($($x:expr),+ $(,)?) => {{
59+
unsafe {
5760
static mut loc: u32 = 0;
5861
if loc == 0 {
5962
let cfile = std::ffi::CString::new(file!()).unwrap();
60-
loc = unsafe { ijon_hashstr(line!(), cfile.as_ptr()) };
63+
loc = ijon_hashstr(line!(), cfile.as_ptr());
6164
}
62-
unsafe { ijon_max_variadic(_IJON_LOC_CACHE, $($x),+, 0u64) };
65+
ijon_max_variadic(_IJON_LOC_CACHE, $($x),+, 0u64)
66+
};
6367
}};
6468
}
6569

6670
#[macro_export]
6771
macro_rules! ijon_min {
6872
($($x:expr),+ $(,)?) => {{
73+
unsafe {
6974
static mut loc: u32 = 0;
7075
if loc == 0 {
7176
let cfile = std::ffi::CString::new(file!()).unwrap();
72-
loc = unsafe { ijon_hashstr(line!(), cfile.as_ptr()) };
77+
loc = ijon_hashstr(line!(), cfile.as_ptr());
7378
}
74-
unsafe { ijon_min_variadic(loc, $($x),+, 0u64) };
79+
ijon_min_variadic(loc, $($x),+, 0u64)
80+
};
7581
}};
7682
}
7783

7884
#[macro_export]
7985
macro_rules! ijon_set {
8086
($x:expr) => {{
81-
static mut loc: u32 = 0;
82-
if loc == 0 {
83-
let cfile = std::ffi::CString::new(file!()).unwrap();
84-
loc = unsafe { ijon_hashstr(line!(), cfile.as_ptr()) };
85-
}
86-
unsafe { ijon_set(loc, $x) };
87+
unsafe {
88+
static mut loc: u32 = 0;
89+
if loc == 0 {
90+
let cfile = std::ffi::CString::new(file!()).unwrap();
91+
loc = ijon_hashstr(line!(), cfile.as_ptr());
92+
}
93+
ijon_set(loc, $x)
94+
};
8795
}};
8896
}
8997

@@ -172,24 +180,28 @@ macro_rules! ijon_cmp {
172180
#[macro_export]
173181
macro_rules! ijon_stack_max {
174182
($x:expr) => {{
175-
static mut loc: u32 = 0;
176-
if loc == 0 {
177-
let cfile = std::ffi::CString::new(file!()).unwrap();
178-
loc = unsafe { ijon_hashstr(line!(), cfile.as_ptr()) };
179-
}
180-
unsafe { ijon_max(ijon_hashint(loc, ijon_hashstack()), $x) };
183+
unsafe {
184+
static mut loc: u32 = 0;
185+
if loc == 0 {
186+
let cfile = std::ffi::CString::new(file!()).unwrap();
187+
loc = ijon_hashstr(line!(), cfile.as_ptr());
188+
}
189+
ijon_max(ijon_hashint(loc, ijon_hashstack()), $x)
190+
};
181191
}};
182192
}
183193

184194
#[macro_export]
185195
macro_rules! ijon_stack_min {
186196
($x:expr) => {{
187-
static mut loc: u32 = 0;
188-
if loc == 0 {
189-
let cfile = std::ffi::CString::new(file!()).unwrap();
190-
loc = unsafe { ijon_hashstr(line!(), cfile.as_ptr()) };
191-
}
192-
unsafe { ijon_min(ijon_hashint(loc, ijon_hashstack()), $x) };
197+
unsafe {
198+
static mut loc: u32 = 0;
199+
if loc == 0 {
200+
let cfile = std::ffi::CString::new(file!()).unwrap();
201+
loc = ijon_hashstr(line!(), cfile.as_ptr());
202+
}
203+
ijon_min(ijon_hashint(loc, ijon_hashstack()), $x)
204+
};
193205
}};
194206
}
195207

0 commit comments

Comments
 (0)