diff options
author | Ran Benita <ran234@gmail.com> | 2016-03-15 20:42:21 +0200 |
---|---|---|
committer | Ran Benita <ran234@gmail.com> | 2016-03-15 20:45:05 +0200 |
commit | 4c24f7faa8bc71589538e8b07ea8b64c84c11b5c (patch) | |
tree | 735e391bcdcd37bad5c7bb152df358958bfd5632 /bench | |
parent | 02628607e0315e9089bed4f32ccf4dacd063b755 (diff) | |
download | xorg-lib-libxkbcommon-4c24f7faa8bc71589538e8b07ea8b64c84c11b5c.tar.gz |
test: assert/ignore some warn_unused_result's
Signed-off-by: Ran Benita <ran234@gmail.com>
Diffstat (limited to 'bench')
-rw-r--r-- | bench/bench.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/bench/bench.c b/bench/bench.c index 9bb535c..37e41f5 100644 --- a/bench/bench.c +++ b/bench/bench.c @@ -33,6 +33,7 @@ #include <sys/time.h> #endif +#include <assert.h> #include <stdlib.h> #include <string.h> #include <stdio.h> @@ -77,7 +78,7 @@ bench_timer_start(struct bench_timer *self) #if defined(USE_CLOCK_GETTIME) struct timespec val; - (void)clock_gettime(CLOCK_MONOTONIC, &val); + (void) clock_gettime(CLOCK_MONOTONIC, &val); /* With conversion from nanosecond to millisecond */ set_bench_time(&self->start, val.tv_sec, val.tv_nsec / 1000); @@ -93,7 +94,7 @@ bench_timer_start(struct bench_timer *self) #else struct timeval val; - (void)gettimeofday(&val, NULL); + (void) gettimeofday(&val, NULL); set_bench_time(&self->start, val.tv_sec, val.tv_usec); #endif @@ -105,7 +106,7 @@ bench_timer_stop(struct bench_timer *self) #if defined(USE_CLOCK_GETTIME) struct timespec val; - (void)clock_gettime(CLOCK_MONOTONIC, &val); + (void) clock_gettime(CLOCK_MONOTONIC, &val); /* With conversion from nanosecond to millisecond */ set_bench_time(&self->stop, val.tv_sec, val.tv_nsec / 1000); @@ -121,7 +122,7 @@ bench_timer_stop(struct bench_timer *self) #else struct timeval val; - (void)gettimeofday(&val, NULL); + (void) gettimeofday(&val, NULL); set_bench_time(&self->stop, val.tv_sec, val.tv_usec); #endif @@ -139,10 +140,12 @@ bench_timer_get_elapsed_time_str(struct bench_timer *self) { struct bench_time elapsed; char *buf; + int ret; bench_timer_get_elapsed_time(self, &elapsed); normalize_bench_time(&elapsed); - asprintf(&buf, "%ld.%06ld", elapsed.seconds, elapsed.milliseconds); + ret = asprintf(&buf, "%ld.%06ld", elapsed.seconds, elapsed.milliseconds); + assert(ret >= 0); return buf; } |