diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2011-03-18 13:22:31 -0400 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2011-03-18 13:22:31 -0400 |
commit | cd86d4410bcff417de15a0fc5eb905ef56c26596 (patch) | |
tree | 54b97075dc41737757b0c5d918c8fc5a0d694614 /gps.h | |
parent | c00be23fbd4cf2aa23d85abc5ec68d31342c010d (diff) | |
download | gpsd-cd86d4410bcff417de15a0fc5eb905ef56c26596.tar.gz |
In the client API, take the data buffer out of the gpsdata_t structure.
tz has shown me that we had a point of brittleness where the size
of the client's data buffer was exposed in gps_data_t. Solution:
move it (and the data-waiting count) to the client's private-data
member. Requires a new but trivial client-library entry point to get
the buffer pointer when a client needs it.
Had to be done before API Version 5 froze, or we'd have been stuck breaking
a shipped API again.
No implications for the daemon or other tools, as this buffer is never
used there. (Except it gets rid of several K of never-used static
buffer space in the daemon, which is a good thing.)
All regression tests pass. Code splints clean. cgps (the only place
the API fix matters in our code) live-tests correctly.
Diffstat (limited to 'gps.h')
-rw-r--r-- | gps.h | 6 |
1 files changed, 1 insertions, 5 deletions
@@ -49,7 +49,6 @@ extern "C" { #define MAXCHANNELS 72 /* must be > 12 GPS + 12 GLONASS + 2 WAAS */ #define GPS_PRNMAX 32 /* above this number are SBAS satellites */ #define GPS_PATH_MAX 64 /* dev files usually have short names */ -#define GPS_BUFFER_MAX 3072 /* enough for two maximun-size JSON objects */ #define MAXUSERDEVS 4 /* max devices per user */ /* @@ -1403,10 +1402,6 @@ struct gps_data_t { char tag[MAXTAGLEN+1]; /* tag of last sentence processed */ - /* data buffered from the last read */ - ssize_t waiting; - char buffer[GPS_BUFFER_MAX * 2]; - /* pack things never reported together to reduce structure size */ #define UNION_SET (RTCM2_SET|RTCM3_SET|SUBFRAME_SET|AIS_SET|VERSION_SET|DEVICELIST_SET|LOGMESSAGE_SET|ERROR_SET|GST_SET) union { @@ -1439,6 +1434,7 @@ extern int gps_send(struct gps_data_t *, const char *, ... ); extern int gps_read(/*@out@*/struct gps_data_t *); extern bool gps_waiting(struct gps_data_t *, int); extern int gps_stream(struct gps_data_t *, unsigned int, /*@null@*/void *); +extern const char /*@observer@*/ *gps_data(struct gps_data_t *); extern const char /*@observer@*/ *gps_errstr(const int); /* this only needs to be visible for the unit tests */ |