Pass setup_code to dc_continue_key_transfer as &str

This commit is contained in:
Alexander Krotov
2019-09-25 02:01:48 +03:00
committed by holger krekel
parent 8165b76001
commit 60bd053095
3 changed files with 7 additions and 15 deletions

View File

@@ -327,11 +327,6 @@ pub unsafe fn dc_cmdline(context: &Context, line: &str) -> Result<(), failure::E
arg1.strdup() as *const _
};
let arg2 = args.next().unwrap_or_default();
let arg2_c = if arg2.is_empty() {
std::ptr::null()
} else {
arg2.strdup() as *const _
};
match arg0 {
"help" | "?" => match arg1 {
@@ -451,7 +446,7 @@ pub unsafe fn dc_cmdline(context: &Context, line: &str) -> Result<(), failure::E
!arg1.is_empty() && !arg2.is_empty(),
"Arguments <msg-id> <setup-code> expected"
);
if !dc_continue_key_transfer(context, arg1.parse()?, arg2_c) {
if !dc_continue_key_transfer(context, arg1.parse()?, &arg2) {
bail!("Continue key transfer failed");
}
}
@@ -1001,7 +996,6 @@ pub unsafe fn dc_cmdline(context: &Context, line: &str) -> Result<(), failure::E
}
free(arg1_c as *mut _);
free(arg2_c as *mut _);
Ok(())
}