refactor(ffi): return null ptr instead of aborting in C API (#2478)
Make C API functions that return pointers return null in case of a panic, instead of aborting. Add ffi_fn! macro rules that enable default error values to be returned by writing "?= <value>" after an ffi function's body.
This commit is contained in:
		| @@ -92,5 +92,5 @@ ffi_fn! { | ||||
|     /// Returns a static ASCII (null terminated) string of the hyper version. | ||||
|     fn hyper_version() -> *const libc::c_char { | ||||
|         VERSION_CSTR.as_ptr() as _ | ||||
|     } | ||||
|     } ?= std::ptr::null() | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user