Skip to content
Snippets Groups Projects
Commit dc769fd9 authored by Hermann Döppes's avatar Hermann Döppes
Browse files

Run ./fmt.sh

parent 3f627b1b
No related branches found
No related tags found
No related merge requests found
......@@ -7,8 +7,9 @@ fn main() {
cc::Build::new()
.flag("-nostdinc")
.flag("-nostdlib")
.flag("-I").flag(&format!("{}/include", crate_dir))
.flag("-nostdlib")
.flag("-I")
.flag(&format!("{}/include", crate_dir))
.flag("-fno-stack-protector")
.file("src/c/fcntl.c")
.file("src/c/stdio.c")
......
......@@ -333,7 +333,7 @@ pub unsafe extern "C" fn memalign(alignment: size_t, size: size_t) -> *mut c_voi
align *= 2;
}
malloc_inner(size, align/2, align)
malloc_inner(size, align / 2, align)
}
#[no_mangle]
......
......@@ -43,11 +43,7 @@ pub unsafe extern "C" fn memchr(s: *const c_void, c: c_int, n: usize) -> *mut c_
}
#[no_mangle]
pub unsafe extern "C" fn memcmp(
s1: *const c_void,
s2: *const c_void,
n: usize,
) -> c_int {
pub unsafe extern "C" fn memcmp(s1: *const c_void, s2: *const c_void, n: usize) -> c_int {
let mut i = 0;
while i < n {
let a = *(s1 as *const u8).offset(i as isize);
......@@ -61,11 +57,7 @@ pub unsafe extern "C" fn memcmp(
}
#[no_mangle]
pub unsafe extern "C" fn memcpy(
s1: *mut c_void,
s2: *const c_void,
n: usize,
) -> *mut c_void {
pub unsafe extern "C" fn memcpy(s1: *mut c_void, s2: *const c_void, n: usize) -> *mut c_void {
let mut i = 0;
while i < n {
*(s1 as *mut u8).offset(i as isize) = *(s2 as *const u8).offset(i as isize);
......@@ -75,11 +67,7 @@ pub unsafe extern "C" fn memcpy(
}
#[no_mangle]
pub unsafe extern "C" fn memmove(
s1: *mut c_void,
s2: *const c_void,
n: usize,
) -> *mut c_void {
pub unsafe extern "C" fn memmove(s1: *mut c_void, s2: *const c_void, n: usize) -> *mut c_void {
if s2 < s1 as *const c_void {
// copy from end
let mut i = n;
......@@ -99,11 +87,7 @@ pub unsafe extern "C" fn memmove(
}
#[no_mangle]
pub unsafe extern "C" fn memset(
s: *mut c_void,
c: c_int,
n: usize,
) -> *mut c_void {
pub unsafe extern "C" fn memset(s: *mut c_void, c: c_int, n: usize) -> *mut c_void {
let mut i = 0;
while i < n {
*(s as *mut u8).offset(i as isize) = c as u8;
......
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