Skip to content

Commit 0d383e5

Browse files
committed
Mkae str_from_c_string() public
1 parent 21cbcb4 commit 0d383e5

File tree

4 files changed

+3
-4
lines changed

4 files changed

+3
-4
lines changed

freertos-rust/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ The freertos-build crate can be used to build and link FreeRTOS from source insi
1010
links = "freertos"
1111
name = "freertos-next"
1212
readme = "README.md"
13-
version = "0.7.2"
13+
version = "0.7.3"
1414

1515

1616
[lib]

freertos-rust/src/hooks.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ pub static FREERTOS_HOOKS: FreeRtosHooks = FreeRtosHooks {
3232
#[allow(unused_doc_comments)]
3333
#[unsafe(no_mangle)]
3434
pub extern "C" fn vAssertCalled(file_name_ptr: FreeRtosCharPtr, line: FreeRtosUBaseType) {
35-
let file_name = unsafe { str_from_c_string(file_name_ptr).unwrap() };
35+
let file_name = unsafe { str_from_c_string(file_name_ptr).unwrap_or("Unknown") };
3636

3737
FREERTOS_HOOKS.do_on_assert();
3838

freertos-rust/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,4 +132,4 @@ pub use crate::timers::*;
132132
pub use crate::units::*;
133133
#[cfg(feature = "cpu_clock")]
134134
pub use crate::utils::cpu_clock_hz;
135-
pub use crate::utils::shim_sanity_check;
135+
pub use crate::utils::{shim_sanity_check, str_from_c_string};

freertos-rust/src/utils.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ pub fn shim_sanity_check() -> Result<(), TypeSizeError> {
5555
/// # Safety
5656
///
5757
/// `str` must be a pointer to the beginning of nul-terminated sequence of bytes.
58-
#[cfg(any(feature = "time", feature = "hooks", feature = "sync"))]
5958
pub unsafe fn str_from_c_string<'a>(str: *const u8) -> Result<&'a str, FreeRtosError> {
6059
match unsafe { CStr::from_ptr(str as *const _).to_str() } {
6160
Ok(s) => Ok(s),

0 commit comments

Comments
 (0)