Skip to content

Commit d9499af

Browse files
committed
Delete libcc2rs::char_array
1 parent 574ecf0 commit d9499af

2 files changed

Lines changed: 2 additions & 12 deletions

File tree

cpp2rust/converter/converter.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1983,11 +1983,11 @@ bool Converter::VisitStringLiteral(clang::StringLiteral *expr) {
19831983
uint64_t pad = arr_size > expr->getString().size()
19841984
? arr_size - expr->getString().size()
19851985
: 0;
1986-
StrCat(std::format("libcc2rs::char_array(b{})",
1986+
StrCat(std::format("unsafe {{ ::std::mem::transmute(*b{}) }}",
19871987
GetEscapedStringLiteral(expr, pad)));
19881988
return false;
19891989
}
1990-
StrCat(std::format("libcc2rs::char_array(b{})",
1990+
StrCat(std::format("unsafe {{ ::std::mem::transmute(*b{}) }}",
19911991
GetEscapedStringLiteral(expr, 1)));
19921992
return false;
19931993
}

libcc2rs/src/lib.rs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,3 @@ mod va_args;
3535
pub use va_args::*;
3636

3737
pub use libcc2rs_macros::{goto, goto_block, switch};
38-
39-
pub const fn char_array<const N: usize>(s: &[u8; N]) -> [core::ffi::c_char; N] {
40-
let mut out = [0 as core::ffi::c_char; N];
41-
let mut i = 0;
42-
while i < N {
43-
out[i] = s[i] as core::ffi::c_char;
44-
i += 1;
45-
}
46-
out
47-
}

0 commit comments

Comments
 (0)