From 2b16a3693e84a2790e86f30b582999f567533a57 Mon Sep 17 00:00:00 2001
From: Paul Sajna <paulsajna@gmail.com>
Date: Sat, 3 Mar 2018 19:42:29 -0800
Subject: [PATCH] wrap all function parameters in Options

---
 src/stdlib/src/lib.rs | 6 +++---
 src/unistd/src/lib.rs | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/stdlib/src/lib.rs b/src/stdlib/src/lib.rs
index ade51a973..49b3bfd43 100644
--- a/src/stdlib/src/lib.rs
+++ b/src/stdlib/src/lib.rs
@@ -39,7 +39,7 @@ pub extern "C" fn abs(i: c_int) -> c_int {
 }
 
 #[no_mangle]
-pub unsafe extern "C" fn atexit(func: extern "C" fn()) -> c_int {
+pub unsafe extern "C" fn atexit(func: Option<extern "C" fn()>) -> c_int {
     for i in 0..ATEXIT_FUNCS.len() {
         if ATEXIT_FUNCS[i] == 0 {
             ATEXIT_FUNCS[i] = func as usize;
@@ -66,7 +66,7 @@ pub extern "C" fn atol(s: *const c_char) -> c_long {
 }
 
 #[no_mangle]
-pub extern "C" fn bsearch(key: *const c_void, base: *const c_void, nel: size_t, width: size_t, compar: extern "C" fn(*const c_void, *const c_void) -> c_int) -> *mut c_void {
+pub extern "C" fn bsearch(key: *const c_void, base: *const c_void, nel: size_t, width: size_t, compar: Option<extern "C" fn(*const c_void, *const c_void)> -> c_int) -> *mut c_void {
     unimplemented!();
 }
 
@@ -265,7 +265,7 @@ pub extern "C" fn putenv(s: *mut c_char) -> c_int {
 }
 
 #[no_mangle]
-pub extern "C" fn qsort(base: *mut c_void, nel: size_t, width: size_t, compar: extern "C" fn(*const c_void, *const c_void) -> c_int) {
+pub extern "C" fn qsort(base: *mut c_void, nel: size_t, width: size_t, compar: Option<extern "C" fn(*const c_void, *const c_void)> -> c_int) {
     unimplemented!();
 }
 
diff --git a/src/unistd/src/lib.rs b/src/unistd/src/lib.rs
index 66905beae..cf911b4f6 100644
--- a/src/unistd/src/lib.rs
+++ b/src/unistd/src/lib.rs
@@ -310,7 +310,7 @@ pub extern "C" fn pread(fildes: c_int, buf: *mut c_void, nbyte: size_t, offset:
 }
 
 #[no_mangle]
-pub extern "C" fn pthread_atfork(prepare: extern "C" fn(), parent: extern "C" fn(), child: extern "C" fn()) -> c_int {
+pub extern "C" fn pthread_atfork(prepare: Option<extern "C" fn()>, parent: Option<extern "C" fn()>, child: Option<extern "C" fn()>) -> c_int {
     unimplemented!();
 }
 
-- 
GitLab