Browse Source

Make functions taking raw pointer return &'a instead of &'static

This is technically more correct, and matches the pointer methods in the
standard library.
Ian Douglas Scott 6 years ago
parent
commit
cbd0d0473c
1 changed files with 2 additions and 2 deletions
  1. 2 2
      src/platform/src/lib.rs

+ 2 - 2
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;