diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2006-09-01 08:03:21 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2006-09-01 08:03:21 +0000 |
commit | cea03e87c6802d93907a9a3535121e1f6b71085d (patch) | |
tree | 26ae1525c903c35ed3ce4c71870cec2b252528e7 | |
parent | f497ce2e6b079a9963321d2de8dcd3247d845c58 (diff) | |
download | gpsd-cea03e87c6802d93907a9a3535121e1f6b71085d.tar.gz |
Reduce the size of the J patch still further. All regression tests pass.
-rw-r--r-- | gpsd.h | 1 | ||||
-rw-r--r-- | libgpsd_core.c | 35 |
2 files changed, 18 insertions, 18 deletions
@@ -278,6 +278,7 @@ extern void gpsd_interpret_subframe(struct gps_device_t *, unsigned int[]); extern /*@ observer @*/ char *gpsd_hexdump(const void *, size_t); extern void gpsd_position_fix_dump(struct gps_device_t *, /*@out@*/char[], size_t); extern void gpsd_error_model(struct gps_device_t *, struct gps_fix_t *); +extern void gpsd_clear_data(struct gps_device_t *); extern int netlib_connectsock(const char *, const char *, const char *); extern int ntpshm_init(struct gps_context_t *, bool); diff --git a/libgpsd_core.c b/libgpsd_core.c index d14ab227..0d45b0b3 100644 --- a/libgpsd_core.c +++ b/libgpsd_core.c @@ -47,6 +47,20 @@ int gpsd_switch_driver(struct gps_device_t *session, char* typename) /*@ +compmempass @*/ } + +void gpsd_clear_data(struct gps_device_t *session) +/* clear all data associated with a GPS session */ +{ + gps_clear_fix(&session->gpsdata.fix); + session->gpsdata.set &=~ (FIX_SET | DOP_SET); + session->gpsdata.hdop = NAN; + session->gpsdata.vdop = NAN; + session->gpsdata.pdop = NAN; + session->gpsdata.tdop = NAN; + session->gpsdata.gdop = NAN; + session->gpsdata.epe = NAN; +} + void gpsd_init(struct gps_device_t *session, struct gps_context_t *context, char *device) /* initialize GPS polling */ { @@ -60,14 +74,7 @@ void gpsd_init(struct gps_device_t *session, struct gps_context_t *context, char /*@ +temptrans @*/ /*@ +mayaliasunique @*/ /*@ +mustfreeonly @*/ - gps_clear_fix(&session->gpsdata.fix); - session->gpsdata.set &=~ (FIX_SET | DOP_SET); - session->gpsdata.hdop = NAN; - session->gpsdata.vdop = NAN; - session->gpsdata.pdop = NAN; - session->gpsdata.tdop = NAN; - session->gpsdata.gdop = NAN; - session->gpsdata.epe = NAN; + gpsd_clear_data(session); /* mark GPS fd closed */ session->gpsdata.gps_fd = -1; @@ -573,16 +580,8 @@ gps_mask_t gpsd_poll(struct gps_device_t *session) received = 0; /* it was all done in the packet getter */ /* Clear fix data at start of cycle */ - if ((received & CYCLE_START_SET)!=0) { - gps_clear_fix(&session->gpsdata.fix); - session->gpsdata.set &=~ (FIX_SET | DOP_SET); - session->gpsdata.hdop = NAN; - session->gpsdata.vdop = NAN; - session->gpsdata.pdop = NAN; - session->gpsdata.tdop = NAN; - session->gpsdata.gdop = NAN; - session->gpsdata.epe = NAN; - } + if ((received & CYCLE_START_SET)!=0) + gpsd_clear_data(session); /* * Compute fix-quality data from the satellite positions. * This may be overridden by DOPs reported from the packet we just got. |