diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2011-09-27 10:38:02 -0400 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2011-09-27 10:38:02 -0400 |
commit | 8b79518d4627859ab8351f1fd01bbaaf0ecee8a9 (patch) | |
tree | f12d0631081284fa45dad22de16f7af76d09e86b | |
parent | 20f16976a1a451c298fee36159daede7749760e6 (diff) | |
download | gpsd-8b79518d4627859ab8351f1fd01bbaaf0ecee8a9.tar.gz |
Refactoring step and minor fixes.
-rw-r--r-- | clockwatcher.c | 5 | ||||
-rw-r--r-- | gpxlogger.c | 3 | ||||
-rw-r--r-- | libgps_dbus.c | 5 |
3 files changed, 4 insertions, 9 deletions
diff --git a/clockwatcher.c b/clockwatcher.c index 4d06570d..a7ff2f72 100644 --- a/clockwatcher.c +++ b/clockwatcher.c @@ -66,8 +66,7 @@ static void quit_handler(int signum) static int dbus_mainloop(void) { - gps_dbus_open(conditionally_log_fix, &gpsdata); - return 0; + return gps_dbus_open(conditionally_log_fix, &gpsdata);; } #endif /* defined(DBUS_EXPORT_ENABLE) && !defined(S_SPLINT_S) */ @@ -104,7 +103,6 @@ static int socket_mainloop(void) conditionally_log_fix(&gpsdata); } } - print_gpx_footer(); (void)gps_close(&gpsdata); return 0; } @@ -137,7 +135,6 @@ static int shm_mainloop(void) if (status > 0) conditionally_log_fix(&gpsdata); } - print_gpx_footer(); (void)gps_close(&gpsdata); return 0; } diff --git a/gpxlogger.c b/gpxlogger.c index 04c76ba2..d0032150 100644 --- a/gpxlogger.c +++ b/gpxlogger.c @@ -192,8 +192,7 @@ static void quit_handler(int signum) static int dbus_mainloop(void) { print_gpx_header(); - gps_dbus_open(conditionally_log_fix, &gpsdata); - return 0; + return gps_dbus_open(conditionally_log_fix, &gpsdata); } #endif /* defined(DBUS_EXPORT_ENABLE) && !defined(S_SPLINT_S) */ diff --git a/libgps_dbus.c b/libgps_dbus.c index 8f84e720..3c05705d 100644 --- a/libgps_dbus.c +++ b/libgps_dbus.c @@ -100,8 +100,6 @@ int gps_dbus_open(void (*handler)(struct gps_data_t *), struct gps_data_t *gpsda return -1; PRIVATE(gpsdata)->handler = handler; - mainloop = g_main_loop_new(NULL, FALSE); - dbus_error_init(&error); connection = dbus_bus_get(DBUS_BUS_SYSTEM, &error); if (dbus_error_is_set(&error)) { @@ -123,8 +121,9 @@ int gps_dbus_open(void (*handler)(struct gps_data_t *), struct gps_data_t *gpsda return 5; } + /* This probably needs to be factored out */ + mainloop = g_main_loop_new(NULL, FALSE); dbus_connection_setup_with_g_main(connection, NULL); - g_main_loop_run(mainloop); return 0; } |