From 4493a8b6eb6a2213f283bd13a0f1cebc072dc9d4 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Sat, 7 Mar 2015 09:34:25 -0500 Subject: Factor PPS-related members of struct gps_device_t into a pps_thread_t structure. No logic changes, though it looks like there are two because two guards that would always have failed when the code was compiled with pps=off are now conditioned out. Also, this code is offset-preserving so as not to break link-time compatibility of libgpsd. (This is the subtler approach...) All regression tests pass. --- libgpsd_core.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) (limited to 'libgpsd_core.c') diff --git a/libgpsd_core.c b/libgpsd_core.c index 5dadde02..1c3c91ca 100644 --- a/libgpsd_core.c +++ b/libgpsd_core.c @@ -317,12 +317,8 @@ void gpsd_init(struct gps_device_t *session, struct gps_context_t *context, /* initialize GPS polling */ { /* clear some times */ - session->last_fixtime.real = 0.0; - /*@i2@*/session->last_fixtime.clock.tv_sec = 0; - /*@i2@*/session->last_fixtime.clock.tv_nsec = 0; #ifdef PPS_ENABLE - memset( (void *)&session->ppslast, 0, sizeof(session->ppslast)); - session->ppscount = 0; + memset((void *)&session->pps_thread, '\0', sizeof(session->pps_thread)); #endif /* PPS_ENABLE */ /*@ -mayaliasunique @*/ @@ -389,7 +385,7 @@ void gpsd_deactivate(struct gps_device_t *session) "DEACTIVATE"); #ifdef PPS_ENABLE /*@-mustfreeonly@*/ - session->thread_report_hook = NULL; /* tell any PPS-watcher thread to die */ + session->pps_thread.report_hook = NULL; /* tell any PPS-watcher thread to die */ #endif /* PPS_ENABLE */ /*@-mustfreeonly@*/ /* mark it inactivated */ @@ -415,13 +411,9 @@ void gpsd_clear(struct gps_device_t *session) /* clear the private data union */ memset( (void *)&session->driver, '\0', sizeof(session->driver)); - /* clear some times */ - session->last_fixtime.real = 0.0; - /*@i2@*/session->last_fixtime.clock.tv_sec = 0; - /*@i2@*/session->last_fixtime.clock.tv_nsec = 0; #ifdef PPS_ENABLE - memset( (void *)&session->ppslast, 0, sizeof(session->ppslast)); - session->ppscount = 0; + /* clear some times */ + memset((void *)&session->pps_thread, 0, sizeof(session->pps_thread)); #endif /* PPS_ENABLE */ session->opentime = timestamp(); -- cgit v1.2.1