From 6885b22471926d3387be8fc491ea016c78917c13 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Tue, 18 Aug 2009 15:30:49 +0000 Subject: More steps towards ?DEVICES decoding - refactor code. --- libgps_json.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'libgps_json.c') diff --git a/libgps_json.c b/libgps_json.c index 39a82025..5732af56 100644 --- a/libgps_json.c +++ b/libgps_json.c @@ -141,15 +141,18 @@ static int json_sky_read(const char *buf, static int json_devices_read(const char *buf, struct gps_data_t *gpsdata, const char **endptr) { + char names[GPS_JSON_DEVICES_MAX][PATH_MAX]; const struct json_attr_t json_attrs_subdevices[] = { // FIXME: Parse device records, too. + {"name", string, .addr.string.ptr = gpsdata->gps_device, + .addr.string.len = sizeof(gpsdata->gps_device)}, {NULL}, }; // FIXME: Can we abolish the hard limit on the number of devices? const struct json_attr_t json_attrs_devices[] = { {"devices", array, .addr.array.element_type = object, .addr.array.arr.subtype = json_attrs_subdevices, - .addr.array.maxlen = 4}, + .addr.array.maxlen = GPS_JSON_DEVICES_MAX}, {NULL}, }; int status; -- cgit v1.2.1