summaryrefslogtreecommitdiff
path: root/libgpsd_core.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2015-03-07 09:34:25 -0500
committerEric S. Raymond <esr@thyrsus.com>2015-03-07 09:34:25 -0500
commit4493a8b6eb6a2213f283bd13a0f1cebc072dc9d4 (patch)
tree74114bfc3140c9ed5bbcf21bd56a7f64556eeb7d /libgpsd_core.c
parenta08a5e6f15f37e3656872751796b6155913fbb6b (diff)
downloadgpsd-4493a8b6eb6a2213f283bd13a0f1cebc072dc9d4.tar.gz
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.
Diffstat (limited to 'libgpsd_core.c')
-rw-r--r--libgpsd_core.c16
1 files changed, 4 insertions, 12 deletions
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();