diff options
author | kyren <kerriganw@gmail.com> | 2017-12-02 17:04:33 -0500 |
---|---|---|
committer | kyren <kerriganw@gmail.com> | 2017-12-02 17:04:33 -0500 |
commit | fa1703d3d1d1c7541e829f0d193860c2281f95f2 (patch) | |
tree | 293f2336e3825bf8826f02e8682180ccc631e738 /src/util.rs | |
parent | 8a7e03978bedc4403ef4f35fdf4c63a9fb5b862f (diff) | |
download | mlua-fa1703d3d1d1c7541e829f0d193860c2281f95f2.zip |
split macros into their own file
Diffstat (limited to 'src/util.rs')
-rw-r--r-- | src/util.rs | 54 |
1 files changed, 0 insertions, 54 deletions
diff --git a/src/util.rs b/src/util.rs index 769024c..8641957 100644 --- a/src/util.rs +++ b/src/util.rs @@ -10,60 +10,6 @@ use std::panic::{catch_unwind, resume_unwind, UnwindSafe}; use ffi; use error::{Error, Result}; -macro_rules! cstr { - ($s:expr) => ( - concat!($s, "\0") as *const str as *const [c_char] as *const c_char - ); -} - -// A panic that clears the given lua stack before panicking -macro_rules! lua_panic { - ($state:expr) => { - { - $crate::ffi::lua_settor($state, 0); - panic!("rlua internal error"); - } - }; - - ($state:expr, $msg:expr) => { - { - $crate::ffi::lua_settop($state, 0); - panic!(concat!("rlua: ", $msg)); - } - }; - - ($state:expr, $fmt:expr, $($arg:tt)+) => { - { - $crate::ffi::lua_settop($state, 0); - panic!(concat!("rlua: ", $fmt), $($arg)+); - } - }; -} - -// An assert that clears the given lua stack before panicking -macro_rules! lua_assert { - ($state:expr, $cond:expr) => { - if !$cond { - $crate::ffi::lua_settop($state, 0); - panic!("rlua internal error"); - } - }; - - ($state:expr, $cond:expr, $msg:expr) => { - if !$cond { - $crate::ffi::lua_settop($state, 0); - panic!(concat!("rlua: ", $msg)); - } - }; - - ($state:expr, $cond:expr, $fmt:expr, $($arg:tt)+) => { - if !$cond { - $crate::ffi::lua_settop($state, 0); - panic!(concat!("rlua: ", $fmt), $($arg)+); - } - }; -} - // Checks that Lua has enough free stack space for future stack operations. // On failure, this will clear the stack and panic. pub unsafe fn check_stack(state: *mut ffi::lua_State, amount: c_int) { |