Skip to content
Snippets Groups Projects
Unverified Commit cbd0d047 authored by Ian Douglas Scott's avatar Ian Douglas Scott
Browse files

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

This is technically more correct, and matches the pointer methods in the
standard library.
parent 3311a700
No related branches found
No related tags found
1 merge request!128Make functions taking raw pointer return &'a instead of &'static
...@@ -33,13 +33,13 @@ use types::*; ...@@ -33,13 +33,13 @@ use types::*;
#[no_mangle] #[no_mangle]
pub static mut errno: c_int = 0; 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; use core::usize;
c_str_n(s, usize::MAX) 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; use core::slice;
let mut size = 0; let mut size = 0;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment