diff options
author | kremlin <ian@kremlin.cc> | 2014-07-15 12:55:24 +0800 |
---|---|---|
committer | kremlin <ian@kremlin.cc> | 2014-07-15 12:55:24 +0800 |
commit | 1e8c7c889a1c3b92c58fb1590b2f1192dd86623b (patch) | |
tree | 53751faad6f0c91408908adc608aef168cbf6bb9 /src/interfaces/hostnamed/hostnamed.c | |
parent | 8751decbc931f5fe64130567a3965fd05c698a64 (diff) | |
download | systembsd-1e8c7c889a1c3b92c58fb1590b2f1192dd86623b.tar systembsd-1e8c7c889a1c3b92c58fb1590b2f1192dd86623b.tar.gz systembsd-1e8c7c889a1c3b92c58fb1590b2f1192dd86623b.tar.bz2 systembsd-1e8c7c889a1c3b92c58fb1590b2f1192dd86623b.tar.lz systembsd-1e8c7c889a1c3b92c58fb1590b2f1192dd86623b.tar.xz systembsd-1e8c7c889a1c3b92c58fb1590b2f1192dd86623b.tar.zst systembsd-1e8c7c889a1c3b92c58fb1590b2f1192dd86623b.zip |
remove includes in non-gen'd interf files, they're linked properly now
no need to include foo-gen.c as its functionality exists inside linked object
built by makefile in future commit. additionally, make all non-generated
interface files executable with a dummy main() that runs foo_init() after
setting everything up properly with a g_main_loop
Diffstat (limited to 'src/interfaces/hostnamed/hostnamed.c')
-rw-r--r-- | src/interfaces/hostnamed/hostnamed.c | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/src/interfaces/hostnamed/hostnamed.c b/src/interfaces/hostnamed/hostnamed.c index e161497..0cdbd36 100644 --- a/src/interfaces/hostnamed/hostnamed.c +++ b/src/interfaces/hostnamed/hostnamed.c @@ -19,11 +19,7 @@ #include <sys/param.h> -#include <glib.h> -#include <gio/gio.h> - -#include "hostnamed.h" -#include "hostnamed-gen.c" +#include "hostnamed-gen.h" GPtrArray *hostnamed_freeable; GDBusNodeInfo *spect_data; @@ -191,6 +187,12 @@ static void hostnamed_on_name_acquired(GDBusConnection *conn, } +/* free()'s */ +void hostnamed_mem_clean() { + + g_ptr_array_foreach(hostnamed_freeable, (GFunc) g_free, NULL); +} + static void hostnamed_on_name_lost(GDBusConnection *conn, const gchar *name, gpointer user_data) { @@ -220,10 +222,19 @@ void hostnamed_init() { /* TODO: malloc and return reference as if a main() closed */ } -/* free()'s */ -void hostnamed_mem_clean() { +int main() { - g_ptr_array_foreach(hostnamed_freeable, (GFunc) g_free, NULL); + GMainLoop *hostnamed_loop; + hostnamed_loop = g_main_loop_new(NULL, TRUE); + + /* config stuff here */ + + + hostnamed_init(); + g_main_loop_run(hostnamed_loop); + g_main_loop_unref(hostnamed_loop); + + return 0; } /* TODO figure out DMI variables on obsd */ @@ -271,3 +282,4 @@ void hostnamed_mem_clean() { g_free (filebuf); return ret; }*/ + |