add dc_get_last_error() (#2788)

* add dc_get_last_error()

* make clippy happy

* simplify block_on() call
This commit is contained in:
bjoern
2021-11-02 22:09:04 +01:00
committed by GitHub
parent 64206160cc
commit 39e1510e64
4 changed files with 79 additions and 0 deletions

View File

@@ -2206,6 +2206,16 @@ pub unsafe extern "C" fn dc_delete_all_locations(context: *mut dc_context_t) {
});
}
#[no_mangle]
pub unsafe extern "C" fn dc_get_last_error(context: *mut dc_context_t) -> *mut libc::c_char {
if context.is_null() {
eprintln!("ignoring careless call to dc_get_last_error()");
return "".strdup();
}
let ctx = &*context;
block_on(ctx.get_last_error()).strdup()
}
// dc_array_t
pub type dc_array_t = dc_array::dc_array_t;