summaryrefslogtreecommitdiff
path: root/libgpsd_core.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2015-03-06 16:52:20 -0500
committerEric S. Raymond <esr@thyrsus.com>2015-03-06 16:52:20 -0500
commit959507faec3641809901ef410c6fd047173d7a13 (patch)
tree944ba178aa59df4dcaa7a1e376a0c801d67aba02 /libgpsd_core.c
parent7bf26f34bae791b5707f64c198712b1922d92c3a (diff)
downloadgpsd-959507faec3641809901ef410c6fd047173d7a13.tar.gz
Simplify context initialization so we don't have to know structure shapes.
Diffstat (limited to 'libgpsd_core.c')
-rw-r--r--libgpsd_core.c31
1 files changed, 4 insertions, 27 deletions
diff --git a/libgpsd_core.c b/libgpsd_core.c
index a8cd72e3..7fae7006 100644
--- a/libgpsd_core.c
+++ b/libgpsd_core.c
@@ -280,35 +280,12 @@ int gpsd_switch_driver(struct gps_device_t *session, char *type_name)
void gps_context_init(struct gps_context_t *context,
/*@observer@*/const char *label)
{
- /* *INDENT-OFF* */
- /*@ -initallelements -nullassign -nullderef -fullinitblock @*/
- struct gps_context_t nullcontext = {
- .valid = 0,
- .readonly = false,
- .fixcnt = 0,
- .start_time = 0,
- .leap_seconds = 0,
- .gps_week = 0,
- .gps_tow = 0,
- .century = 0,
- .rollovers = 0,
+ (void)memset(context, '\0', sizeof(struct gps_context_t));
+ //context.readonly = false;
#ifdef TIMEHINT_ENABLE
- .leap_notify = LEAP_NOWARNING,
+ context->leap_notify = LEAP_NOWARNING;
#endif /* TIMEHINT_ENABLE */
-#ifdef NTPSHM_ENABLE
- .shmTime = {0},
-#endif /* NTPSHM_ENABLE */
-#ifdef PPS_ENABLE
- .pps_hook = NULL,
-#endif /* PPS_ENABLE */
-#ifdef SHM_EXPORT_ENABLE
- .shmexport = NULL,
-#endif /* SHM_EXPORT_ENABLE */
- .serial_write = gpsd_serial_write,
- };
- /*@ +initallelements +nullassign +nullderef +fullinitblock @*/
- /* *INDENT-ON* */
- (void)memcpy(context, &nullcontext, sizeof(struct gps_context_t));
+ context->serial_write = gpsd_serial_write;
errout_reset(&context->errout);
context->errout.label = (char *)label;