Skip to content
This repository was archived by the owner on Nov 12, 2025. It is now read-only.

Commit fc1f681

Browse files
authored
Fix potential printgm bug
Missing a null char at the end
1 parent 5df63f3 commit fc1f681

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/helpers.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
#[deprecated(
66
since = "0.2.0",
7-
note = "Use b\"string\\0\".as_ptr() format or CStrings directly instead."
7+
note = "Use b\"string\\0\".as_ptr() as *const i8 format or CStrings directly instead."
88
)]
99
#[macro_export]
1010
macro_rules! cstring {
@@ -39,10 +39,10 @@ macro_rules! printgm {
3939
{
4040
let printargs = format!( $($x,)* );
4141
if let Ok(fmt) = std::ffi::CString::new(printargs) {
42-
rglua::lua_shared::lua_getglobal( $state, b"print".as_ptr() as *const std::os::raw::c_char );
42+
rglua::lua_shared::lua_getglobal( $state, b"print\0".as_ptr() as *const i8 );
4343
rglua::lua_shared::lua_pushstring( $state, fmt.as_ptr() );
4444
rglua::lua_shared::lua_call( $state, 1, 0 );
4545
}
4646
}
4747
};
48-
}
48+
}

0 commit comments

Comments
 (0)