aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--dome_key_map.h13
-rw-r--r--src/cocoa_bridge.rs8
-rw-r--r--src/config.rs4
3 files changed, 12 insertions, 13 deletions
diff --git a/dome_key_map.h b/dome_key_map.h
index 39ba298..74369b7 100644
--- a/dome_key_map.h
+++ b/dome_key_map.h
@@ -17,8 +17,6 @@ typedef enum {
MapKind_Command,
} MapKind;
-typedef struct Config Config;
-
typedef struct State State;
typedef struct {
@@ -26,9 +24,16 @@ typedef struct {
size_t length;
} Trigger;
-void c_run_key_action(State *state, Trigger trigger, const Trigger *mode);
+typedef struct {
+ bool reload;
+ bool daemon;
+} Args;
-void config_free(Config *ptr);
+typedef struct {
+ Args args;
+} Config;
+
+void c_run_key_action(State *state, Trigger trigger, const Trigger *mode);
void logger_init(void);
diff --git a/src/cocoa_bridge.rs b/src/cocoa_bridge.rs
index f572c37..529fb5d 100644
--- a/src/cocoa_bridge.rs
+++ b/src/cocoa_bridge.rs
@@ -319,13 +319,7 @@ pub extern "C" fn parse_args(
let config = config::parse_args(&args);
- Box::into_raw(Box::new(config)) as *const Config
-}
-
-#[no_mangle]
-pub extern "C" fn config_free(ptr: *mut Config) {
- if ptr.is_null() { return }
- unsafe { Box::from_raw(ptr); }
+ &config as *const Config
}
diff --git a/src/config.rs b/src/config.rs
index 66769a9..b7b09ab 100644
--- a/src/config.rs
+++ b/src/config.rs
@@ -1,13 +1,13 @@
use getopts::Options;
-#[no_mangle]
+#[repr(C)]
#[derive(Default)]
struct Args {
reload: bool,
daemon: bool,
}
-#[no_mangle]
+#[repr(C)]
#[derive(Default)]
pub struct Config {
args: Args,