Fix more macro hygiene
This commit is contained in:
parent
9d9d3953ff
commit
2b94d70a38
|
@ -2,7 +2,7 @@
|
|||
/// Common pattern for detouring.
|
||||
macro_rules! find_gmod_signature {
|
||||
(($library:ident, $library_path:ident), @EXPORT = $export:literal) => {
|
||||
$library.get(concat!($export, '\0').as_bytes()).ok().map(|func: ::gmod::libloading::Symbol<'_, _>| *func)
|
||||
$library.get(concat!($export, '\0').as_bytes()).ok().map(|func: $crate::libloading::Symbol<'_, _>| *func)
|
||||
};
|
||||
|
||||
(($library:ident, $library_path:ident), @SIG = $sig:literal) => {
|
||||
|
|
|
@ -41,6 +41,6 @@ pub enum LuaError {
|
|||
#[macro_export]
|
||||
macro_rules! lua_string {
|
||||
( $str:literal ) => {
|
||||
::gmod::cstr::cstr!($str).as_ptr()
|
||||
$crate::cstr::cstr!($str).as_ptr()
|
||||
};
|
||||
}
|
||||
|
|
|
@ -61,21 +61,21 @@ lazy_static::lazy_static! {
|
|||
}
|
||||
#[macro_export]
|
||||
macro_rules! colormsg {
|
||||
($($($arg:expr)+),+) => {
|
||||
$(::gmod::msgc::colormsg!(@print $($arg)+));+
|
||||
($($arg:tt),+) => {
|
||||
$($crate::colormsg!(@print $arg));+
|
||||
};
|
||||
|
||||
(@print [$r:literal, $g:literal, $b:literal] $fmt:literal % ($($arg:tt),+)) => {
|
||||
::gmod::msgc::ConColorMsg(
|
||||
&::gmod::msgc::Color::new($r, $g, $b),
|
||||
::gmod::msgc::printf_escape(format!(concat!($fmt, '\0'), $($arg),+)).as_ptr() as *const _,
|
||||
$crate::msgc::ConColorMsg(
|
||||
&$crate::msgc::Color::new($r, $g, $b),
|
||||
$crate::msgc::printf_escape(format!(concat!($fmt, '\0'), $($arg),+)).as_ptr() as *const _,
|
||||
)
|
||||
};
|
||||
|
||||
(@print [$r:literal, $g:literal, $b:literal] $str:literal) => {
|
||||
::gmod::msgc::ConColorMsg(
|
||||
&::gmod::msgc::Color::new($r, $g, $b),
|
||||
::gmod::msgc::printf_escape(concat!($str, '\0')).as_ptr() as *const _,
|
||||
$crate::msgc::ConColorMsg(
|
||||
&$crate::msgc::Color::new($r, $g, $b),
|
||||
$crate::msgc::printf_escape(concat!($str, '\0')).as_ptr() as *const _,
|
||||
)
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue