From cbd0d0473c8a82a6cab4ee552852d5c4ea792cbe Mon Sep 17 00:00:00 2001 From: Ian Douglas Scott Date: Thu, 24 May 2018 11:13:55 -0700 Subject: [PATCH] Make functions taking raw pointer return &'a instead of &'static This is technically more correct, and matches the pointer methods in the standard library. --- src/platform/src/lib.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/platform/src/lib.rs b/src/platform/src/lib.rs index bd61e28f32..fa5ed9a3a7 100644 --- a/src/platform/src/lib.rs +++ b/src/platform/src/lib.rs @@ -33,13 +33,13 @@ use types::*; #[no_mangle] pub static mut errno: c_int = 0; -pub unsafe fn c_str(s: *const c_char) -> &'static [u8] { +pub unsafe fn c_str<'a>(s: *const c_char) -> &'a [u8] { use core::usize; c_str_n(s, usize::MAX) } -pub unsafe fn c_str_n(s: *const c_char, n: usize) -> &'static [u8] { +pub unsafe fn c_str_n<'a>(s: *const c_char, n: usize) -> &'a [u8] { use core::slice; let mut size = 0;