diff options
author | Zbigniew Chyla <zbigniew@chyla.pl> | 2015-01-16 15:46:59 +0100 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2015-01-21 10:47:35 -0500 |
commit | fca5b90829621e119a310225b4f1358cd6914d5c (patch) | |
tree | d45368bac641c99877370a2bf0e29828bd7a10df /libgps_sock.c | |
parent | 4abdcf1ac9a891a5010f238214150adbc2073b38 (diff) | |
download | gpsd-fca5b90829621e119a310225b4f1358cd6914d5c.tar.gz |
Add str_rstrip_char, use it everywhere.
This change doesn't affect generated binary code.
Diffstat (limited to 'libgps_sock.c')
-rw-r--r-- | libgps_sock.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/libgps_sock.c b/libgps_sock.c index 95f8b84c..8d3a8742 100644 --- a/libgps_sock.c +++ b/libgps_sock.c @@ -522,8 +522,7 @@ int gps_sock_stream(struct gps_data_t *gpsdata, unsigned int flags, (void)strlcat(buf, "\"split24\":false,", sizeof(buf)); if (flags & WATCH_PPS) (void)strlcat(buf, "\"pps\":false,", sizeof(buf)); - if (buf[strlen(buf) - 1] == ',') - buf[strlen(buf) - 1] = '\0'; + str_rstrip_char(buf, ','); (void)strlcat(buf, "};", sizeof(buf)); } libgps_debug_trace((DEBUG_CALLS, "gps_stream() disable command: %s\n", buf)); @@ -556,8 +555,7 @@ int gps_sock_stream(struct gps_data_t *gpsdata, unsigned int flags, if (flags & WATCH_DEVICE) str_appendf(buf, sizeof(buf), "\"device\":\"%s\",", (char *)d); /*@+nullpass@*/ - if (buf[strlen(buf) - 1] == ',') - buf[strlen(buf) - 1] = '\0'; + str_rstrip_char(buf, ','); (void)strlcat(buf, "};", sizeof(buf)); } libgps_debug_trace((DEBUG_CALLS, "gps_stream() enable command: %s\n", buf)); |