From 784cef82783d418d7568a7969c909e525023dbd1 Mon Sep 17 00:00:00 2001 From: Kirill Bulatov Date: Mon, 16 Oct 2023 13:24:58 +0300 Subject: [PATCH] Fix macro expansion errors --- src/graphics.rs | 4 ++-- src/lib.rs | 2 +- src/lua.rs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/graphics.rs b/src/graphics.rs index c678d0e..2b09add 100644 --- a/src/graphics.rs +++ b/src/graphics.rs @@ -756,8 +756,8 @@ impl Graphics { let c_path = CString::new(path).map_err(Error::msg)?; let mut out_err: *const crankstart_sys::ctypes::c_char = ptr::null_mut(); let font = pd_func_caller!((*self.0).loadFont, c_path.as_ptr(), &mut out_err)?; - if font == ptr::null_mut() { - if out_err != ptr::null_mut() { + if font.is_null() { + if !out_err.is_null() { let err_msg = unsafe { CStr::from_ptr(out_err).to_string_lossy().into_owned() }; Err(anyhow!(err_msg)) } else { diff --git a/src/lib.rs b/src/lib.rs index 4a61cd3..78ea5cc 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -205,7 +205,7 @@ impl GameRunner { #[macro_export] macro_rules! crankstart_game { ($game_struct:tt) => { - crankstart_game!($game_struct, PDSystemEvent::kEventInit) + crankstart_game!($game_struct, PDSystemEvent::kEventInit); }; ($game_struct:tt, $pd_system_event:expr) => { pub mod game_setup { diff --git a/src/lua.rs b/src/lua.rs index 4283762..5c35eb3 100644 --- a/src/lua.rs +++ b/src/lua.rs @@ -27,7 +27,7 @@ impl Lua { let c_name = CString::new(name).map_err(Error::msg)?; let mut out_err: *const crankstart_sys::ctypes::c_char = ptr::null_mut(); pd_func_caller!((*self.0).addFunction, f, c_name.as_ptr(), &mut out_err)?; - if out_err != ptr::null_mut() { + if !out_err.is_null() { let err_msg = unsafe { CStr::from_ptr(out_err).to_string_lossy().into_owned() }; Err(anyhow!(err_msg)) } else {