summaryrefslogtreecommitdiffstats
path: root/src/host.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/host.c')
-rw-r--r--src/host.c70
1 files changed, 36 insertions, 34 deletions
diff --git a/src/host.c b/src/host.c
index 90efceb..67936be 100644
--- a/src/host.c
+++ b/src/host.c
@@ -33,53 +33,55 @@ suil_host_new(SuilPortWriteFunc write_func,
SuilPortSubscribeFunc subscribe_func,
SuilPortUnsubscribeFunc unsubscribe_func)
{
- SuilHost* host = (SuilHost*)calloc(1, sizeof(struct SuilHostImpl));
- host->write_func = write_func;
- host->index_func = index_func;
- host->subscribe_func = subscribe_func;
- host->unsubscribe_func = unsubscribe_func;
- host->argc = suil_argc;
- host->argv = suil_argv;
- return host;
+ SuilHost* host = (SuilHost*)calloc(1, sizeof(struct SuilHostImpl));
+
+ host->write_func = write_func;
+ host->index_func = index_func;
+ host->subscribe_func = subscribe_func;
+ host->unsubscribe_func = unsubscribe_func;
+ host->argc = suil_argc;
+ host->argv = suil_argv;
+
+ return host;
}
SUIL_API
void
-suil_host_set_touch_func(SuilHost* host,
- SuilTouchFunc touch_func)
+suil_host_set_touch_func(SuilHost* host, SuilTouchFunc touch_func)
{
- host->touch_func = touch_func;
+ host->touch_func = touch_func;
}
SUIL_API
void
suil_host_free(SuilHost* host)
{
- if (host) {
- if (host->gtk_lib) {
- dylib_close(host->gtk_lib);
- }
- free(host);
- }
+ if (host) {
+ if (host->gtk_lib) {
+ dylib_close(host->gtk_lib);
+ }
+
+ free(host);
+ }
}
#ifdef SUIL_WITH_X11
static void
suil_load_init_module(const char* module_name)
{
- void* const lib = suil_open_module(module_name);
- if (!lib) {
- return;
- }
-
- SuilVoidFunc init_func = suil_dlfunc(lib, "suil_host_init");
- if (init_func) {
- (*init_func)();
- } else {
- SUIL_ERRORF("Corrupt init module %s\n", module_name);
- }
-
- dylib_close(lib);
+ void* const lib = suil_open_module(module_name);
+ if (!lib) {
+ return;
+ }
+
+ SuilVoidFunc init_func = suil_dlfunc(lib, "suil_host_init");
+ if (init_func) {
+ (*init_func)();
+ } else {
+ SUIL_ERRORF("Corrupt init module %s\n", module_name);
+ }
+
+ dylib_close(lib);
}
#endif
@@ -87,12 +89,12 @@ SUIL_API
void
suil_init(int* argc, char*** argv, SuilArg key, ...)
{
- (void)key;
+ (void)key;
- suil_argc = argc ? *argc : 0;
- suil_argv = argv ? *argv : NULL;
+ suil_argc = argc ? *argc : 0;
+ suil_argv = argv ? *argv : NULL;
#ifdef SUIL_WITH_X11
- suil_load_init_module("suil_x11");
+ suil_load_init_module("suil_x11");
#endif
}