summaryrefslogtreecommitdiff
path: root/gpsutils.c
diff options
context:
space:
mode:
authorZbigniew Chyla <zbigniew.chyla@nsn.com>2015-02-16 01:30:08 +0100
committerEric S. Raymond <esr@thyrsus.com>2015-02-15 22:04:33 -0500
commit49fe1997713deac3440fbb2c960305762eb500f6 (patch)
treef78e265809be7e52b6f82893e830c76af46700f8 /gpsutils.c
parent68eaa6fc71f4d03b8d6fc3361569ba0906ee394d (diff)
downloadgpsd-49fe1997713deac3440fbb2c960305762eb500f6.tar.gz
Remove unused and incorrect retval from timespec_str
All callers ignore value returned by timespec_str. Additionally, the function returns simply the result of snprintf(), which is not necessarily the number of chars written to the buffer (if the buffer provided by the caller was too small).
Diffstat (limited to 'gpsutils.c')
-rw-r--r--gpsutils.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/gpsutils.c b/gpsutils.c
index d4002bdd..fa15bc49 100644
--- a/gpsutils.c
+++ b/gpsutils.c
@@ -487,8 +487,6 @@ double earth_distance(double lat1, double lon1, double lat2, double lon2)
/* Convert a normailized timespec to a nice string
* put in it *buf, buf should be at least 22 bytes
- * return negative for error
- * otherwise the number of chars in buf, excluding trailing \0
*
* the returned buffer will look like, shortest case:
* sign character ' ' or '-'
@@ -502,19 +500,17 @@ double earth_distance(double lat1, double lon1, double lat2, double lon2)
* So 21 digits like this: "-2147483647.123456789"
*
*/
-int timespec_str(const struct timespec *ts, /*@out@*/char *buf, int buf_size)
+void timespec_str(const struct timespec *ts, /*@out@*/char *buf, int buf_size)
{
- int ret;
char sign = ' ';
/*@-type@*//* splint is confused about timespec*/
if ( (0 > ts->tv_nsec ) || ( 0 > ts->tv_sec ) ) {
sign = '-';
}
- ret = snprintf( buf, buf_size, "%c%ld.%09ld",
+ (void) snprintf( buf, buf_size, "%c%ld.%09ld",
sign,
(long)labs(ts->tv_sec),
(long)labs(ts->tv_nsec));
/*@+type@*/
- return ret;
}