summaryrefslogtreecommitdiff
path: root/ntpshm.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2005-05-27 19:45:25 +0000
committerEric S. Raymond <esr@thyrsus.com>2005-05-27 19:45:25 +0000
commitb297ae5a6ba32c36d5bd352524d318f967a61dfa (patch)
tree62ed46de815ae6c3b87c1849d4996aecc0b55c21 /ntpshm.c
parent7a1fdd3999e03cacf4599685517dd906f593323c (diff)
downloadgpsd-b297ae5a6ba32c36d5bd352524d318f967a61dfa.tar.gz
698 splint warnings.
Diffstat (limited to 'ntpshm.c')
-rw-r--r--ntpshm.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/ntpshm.c b/ntpshm.c
index d4d4af5a..6cae964d 100644
--- a/ntpshm.c
+++ b/ntpshm.c
@@ -63,9 +63,8 @@ static struct shmTime *getShmTime(int unit)
}
}
+int ntpshm_init(struct gps_context_t *context, bool enablepps)
/* attach all NTP SHM segments. called once at startup, while still root */
-
-int ntpshm_init(struct gps_context_t *context, int enablepps)
{
int i;
@@ -79,15 +78,14 @@ int ntpshm_init(struct gps_context_t *context, int enablepps)
return 1;
}
-/* allocate NTP SHM segment. return its segment number, or -1 */
-
int ntpshm_alloc(struct gps_context_t *context)
+/* allocate NTP SHM segment. return its segment number, or -1 */
{
int i;
for (i = 0; i < NTPSHMSEGS; i++)
if (context->shmTime[i] != NULL && !context->shmTimeInuse[i]) {
- context->shmTimeInuse[i]++;
+ context->shmTimeInuse[i] = true;
memset((void *)context->shmTime[i],0,sizeof(struct shmTime));
context->shmTime[i]->mode = 1;
@@ -100,20 +98,20 @@ int ntpshm_alloc(struct gps_context_t *context)
return -1;
}
-/* free NTP SHM segment */
-int ntpshm_free(struct gps_context_t *context, int segment)
+bool ntpshm_free(struct gps_context_t *context, int segment)
+/* free NTP SHM segment */
{
if (segment < 0 || segment >= NTPSHMSEGS)
- return 0;
+ return false;
- context->shmTimeInuse[segment] = 0;
- return 1;
+ context->shmTimeInuse[segment] = false;
+ return true;
}
-/* put a received fix time into shared memory for NTP */
int ntpshm_put(struct gps_device_t *session, double fixtime)
+/* put a received fix time into shared memory for NTP */
{
struct shmTime *shmTime;
struct timeval tv;