refactor: reduce dependencies on libc

This commit is contained in:
Friedel Ziegelmayer
2019-06-08 17:13:05 +02:00
committed by GitHub
parent 39b82c2607
commit 4e41dbf5ab

View File

@@ -160,12 +160,12 @@ pub unsafe fn dc_param_get_int(
if param.is_null() || key == 0i32 { if param.is_null() || key == 0i32 {
return def; return def;
} }
let str: *mut libc::c_char = dc_param_get(param, key, 0 as *const libc::c_char); let s = dc_param_get(param, key, 0 as *const libc::c_char);
if str.is_null() { if s.is_null() {
return def; return def;
} }
let ret: int32_t = as_str(str).parse().unwrap_or_default(); let ret = as_str(s).parse().unwrap_or_default();
free(str as *mut libc::c_void); free(s as *mut libc::c_void);
ret ret
} }