diff options
author | Justus Winter <justus@sequoia-pgp.org> | 2019-01-15 17:57:35 +0100 |
---|---|---|
committer | Justus Winter <justus@sequoia-pgp.org> | 2019-01-15 18:02:37 +0100 |
commit | 977fae00f57ca87fa08568a3ce0f55a5382af13a (patch) | |
tree | 64afb0bfe2768efee998964a640fd3e24ec75505 /ffi/src/core.rs | |
parent | 1f504ddf2d09f62ea3a68aab6deeac24aa813b54 (diff) |
ffi: Allocate returned strings using libc.
- Allocate all returned strings using libc's allocator. This has
the advantage that the user can easily use strings and free them
using free(3).
- Fixes #157.
Diffstat (limited to 'ffi/src/core.rs')
-rw-r--r-- | ffi/src/core.rs | 9 |
1 files changed, 0 insertions, 9 deletions
diff --git a/ffi/src/core.rs b/ffi/src/core.rs index 609b65f9..88ee0570 100644 --- a/ffi/src/core.rs +++ b/ffi/src/core.rs @@ -40,7 +40,6 @@ use failure; use std::fs::File; -use std::ffi::CString; use std::io::{self, Read, Write, Cursor}; use std::path::Path; use std::ptr; @@ -76,14 +75,6 @@ pub extern "system" fn sq_context_last_error(ctx: *mut Context) maybe_box_raw!(ctx.e.take()) } -/// Frees a string returned from Sequoia. -#[no_mangle] -pub extern "system" fn sq_string_free(s: *mut c_char) { - if ! s.is_null() { - unsafe { drop(CString::from_raw(s)) } - } -} - /// Creates a Context with reasonable defaults. /// /// `domain` should uniquely identify your application, it is strongly |