rust: allow expression in str_to_cstr
`str_to_cstr(..., CONSTANT_SIZE)` didn't work, now it does.
@@ -54,7 +54,7 @@ pub fn str_from_null_terminated(input: &[u8]) -> Result<&str, core::str::Utf8Err
/// ```
#[macro_export]
macro_rules! str_to_cstr {
- ($input:expr, $len:literal) => {{
+ ($input:expr, $len:expr) => {{
let mut buf = [0u8; $len + 1];
if !$input.is_ascii() {
Err(buf)
@@ -78,7 +78,7 @@ macro_rules! str_to_cstr {
#[macro_export]
macro_rules! str_to_cstr_force {
- ($input:expr, $len:literal) => {
+ ($input:expr, $len:expr) => {
match $crate::str_to_cstr!($input, $len) {
Ok(buf) => buf,
Err(_) => panic!("str did not fit"),
