summaryrefslogtreecommitdiffstats
path: root/ffi/src/net.rs
diff options
context:
space:
mode:
authorJustus Winter <justus@sequoia-pgp.org>2019-01-09 16:07:50 +0100
committerJustus Winter <justus@sequoia-pgp.org>2019-01-09 16:48:40 +0100
commitfd95fa4f42afa73d09a3d32e88acd083fef756d5 (patch)
tree7fdc3a0d8400e9abfdbed4f44267aecbab895bcd /ffi/src/net.rs
parent2a0e31feb5359887fc7574e9957bea0905950d63 (diff)
ffi: Use *const T for non-optional arguments.
- Previously, Option<&T> was used, primarily because it was more ergonomic in Rust. However, this gave the impression that the argument was optional. - Likewise for mutable references. - This patch addresses all pointers to Rust values. - See #149.
Diffstat (limited to 'ffi/src/net.rs')
-rw-r--r--ffi/src/net.rs19
1 files changed, 10 insertions, 9 deletions
diff --git a/ffi/src/net.rs b/ffi/src/net.rs
index 1506911a..177badea 100644
--- a/ffi/src/net.rs
+++ b/ffi/src/net.rs
@@ -49,7 +49,7 @@ use super::core::Context;
///
/// Returns `NULL` on errors.
#[no_mangle]
-pub extern "system" fn sq_keyserver_new(ctx: Option<&mut Context>,
+pub extern "system" fn sq_keyserver_new(ctx: *mut Context,
uri: *const c_char) -> *mut KeyServer {
let ctx = ffi_param_ref_mut!(ctx);
let uri = unsafe {
@@ -67,7 +67,7 @@ pub extern "system" fn sq_keyserver_new(ctx: Option<&mut Context>,
///
/// Returns `NULL` on errors.
#[no_mangle]
-pub extern "system" fn sq_keyserver_with_cert(ctx: Option<&mut Context>,
+pub extern "system" fn sq_keyserver_with_cert(ctx: *mut Context,
uri: *const c_char,
cert: *const uint8_t,
len: size_t) -> *mut KeyServer {
@@ -99,7 +99,7 @@ pub extern "system" fn sq_keyserver_with_cert(ctx: Option<&mut Context>,
///
/// Returns `NULL` on errors.
#[no_mangle]
-pub extern "system" fn sq_keyserver_sks_pool(ctx: Option<&mut Context>)
+pub extern "system" fn sq_keyserver_sks_pool(ctx: *mut Context)
-> *mut KeyServer {
let ctx = ffi_param_ref_mut!(ctx);
fry_box!(ctx, KeyServer::sks_pool(&ctx.c))
@@ -115,9 +115,10 @@ pub extern "system" fn sq_keyserver_free(ks: *mut KeyServer) {
///
/// Returns `NULL` on errors.
#[no_mangle]
-pub extern "system" fn sq_keyserver_get(ctx: Option<&mut Context>,
- ks: Option<&mut KeyServer>,
- id: Option<&KeyID>) -> *mut TPK {
+pub extern "system" fn sq_keyserver_get(ctx: *mut Context,
+ ks: *mut KeyServer,
+ id: *const KeyID)
+ -> *mut TPK {
let ctx = ffi_param_ref_mut!(ctx);
let ks = ffi_param_ref_mut!(ks);
let id = ffi_param_ref!(id);
@@ -129,9 +130,9 @@ pub extern "system" fn sq_keyserver_get(ctx: Option<&mut Context>,
///
/// Returns != 0 on errors.
#[no_mangle]
-pub extern "system" fn sq_keyserver_send(ctx: Option<&mut Context>,
- ks: Option<&mut KeyServer>,
- tpk: Option<&TPK>)
+pub extern "system" fn sq_keyserver_send(ctx: *mut Context,
+ ks: *mut KeyServer,
+ tpk: *const TPK)
-> Status {
let ctx = ffi_param_ref_mut!(ctx);
let ks = ffi_param_ref_mut!(ks);