summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2013-11-02 10:41:07 -0400
committerEric S. Raymond <esr@thyrsus.com>2013-11-02 10:41:07 -0400
commitdae540addfe666a5a296d9be40a283da7dc3d2fe (patch)
treefbe0f8a75c32dd173de604aac33d018b035d2280
parent05416cc2c661d3f4c8b391723051927d524f4688 (diff)
downloadgpsd-dae540addfe666a5a296d9be40a283da7dc3d2fe.tar.gz
Eliminate an enable flag that always gets set true.
All regression tests pass. PPS is live.
-rw-r--r--gpsd.c4
-rw-r--r--gpsd.h-tail9
-rw-r--r--libgpsd_core.c1
-rw-r--r--ntpshm.c6
4 files changed, 8 insertions, 12 deletions
diff --git a/gpsd.c b/gpsd.c
index 51647637..91f76130 100644
--- a/gpsd.c
+++ b/gpsd.c
@@ -1524,9 +1524,7 @@ static void all_reports(struct gps_device_t *device, gps_mask_t changed)
* Only update the NTP time if we've seen the leap-seconds data.
* Else we may be providing GPS time.
*/
- if (device->context->enable_ntpshm == 0) {
- //gpsd_report(context.debug, LOG_PROG, "NTP: off\n");
- } else if ((changed & TIME_SET) == 0) {
+ if ((changed & TIME_SET) == 0) {
//gpsd_report(context.debug, LOG_PROG, "NTP: No time this packet\n");
} else if (isnan(device->newdata.time)) {
//gpsd_report(context.debug, LOG_PROG, "NTP: bad new time\n");
diff --git a/gpsd.h-tail b/gpsd.h-tail
index d4ddbbcf..90746724 100644
--- a/gpsd.h-tail
+++ b/gpsd.h-tail
@@ -248,16 +248,17 @@ struct gps_context_t {
#define LEAP_ADDSECOND 0x1 /* last minute of day has 60 seconds */
#define LEAP_DELSECOND 0x2 /* last minute of day has 59 seconds */
#define LEAP_NOTINSYNC 0x3 /* overload, clock is free running */
- bool enable_ntpshm;
+#endif /* TIMEHINT_ENABLE */
+#ifdef NTPSHM_ENABLE
/* we need the volatile here to tell the C compiler not to
* 'optimize' as 'dead code' the writes to SHM */
/*@reldef@*/volatile struct shmTime *shmTime[NTPSHMSEGS];
bool shmTimeInuse[NTPSHMSEGS];
-#endif /* TIMEHINT_ENABLE */
-# ifdef PPS_ENABLE
+#endif /* NTPSHM_ENABLE */
+#ifdef PPS_ENABLE
/*@null@*/ void (*pps_hook)(struct gps_device_t *,
unsigned long, struct timespec *);
-# endif /* PPS_ENABLE */
+#endif /* PPS_ENABLE */
#ifdef SHM_EXPORT_ENABLE
/* we don't want the compiler to treat writes to shmexport as dead code,
* and we don't want them reordered either */
diff --git a/libgpsd_core.c b/libgpsd_core.c
index 1f5c6fc3..1d5038d9 100644
--- a/libgpsd_core.c
+++ b/libgpsd_core.c
@@ -235,7 +235,6 @@ void gps_context_init(struct gps_context_t *context)
.leap_notify = LEAP_NOWARNING,
#endif /* TIMEHINT_ENABLE */
#ifdef NTPSHM_ENABLE
- .enable_ntpshm = false,
.shmTime = {0},
.shmTimeInuse = {0},
#endif /* NTPSHM_ENABLE */
diff --git a/ntpshm.c b/ntpshm.c
index f710a02a..0388a117 100644
--- a/ntpshm.c
+++ b/ntpshm.c
@@ -167,7 +167,6 @@ void ntpshm_context_init(struct gps_context_t *context)
}
}
memset(context->shmTimeInuse, 0, sizeof(context->shmTimeInuse));
- context->enable_ntpshm = true;
}
static int ntpshm_alloc(struct gps_context_t *context)
@@ -482,9 +481,8 @@ void ntpshm_link_deactivate(struct gps_device_t *session)
void ntpshm_link_activate(struct gps_device_t *session)
/* set up ntpshm storage for a session */
{
- /* If we are talking to ntpd, allocate a shared-memory segment for "NMEA" time data */
- if (session->context->enable_ntpshm)
- session->shmindex = ntpshm_alloc(session->context);
+ /* allocate a shared-memory segment for "NMEA" time data */
+ session->shmindex = ntpshm_alloc(session->context);
if (0 > session->shmindex) {
gpsd_report(session->context->debug, LOG_INF, "NTPD ntpshm_alloc() failed\n");