test: assert/ignore some warn_unused_result's
authorRan Benita <ran234@gmail.com>
Tue, 15 Mar 2016 18:42:21 +0000 (20:42 +0200)
committerRan Benita <ran234@gmail.com>
Tue, 15 Mar 2016 18:45:05 +0000 (20:45 +0200)
Signed-off-by: Ran Benita <ran234@gmail.com>
bench/bench.c
test/interactive-evdev.c
test/interactive-x11.c

index 9bb535c2b386e4a7a237196e1a6285c1c0254ced..37e41f5fa6439f5cf73926a7a21772e6e899c31b 100644 (file)
@@ -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;
 }
index 04a347f3bd0bf93a19b558a212304a7c7c310e68..7fdc069a5a7faec8cfc2e57b3b42df2e8df19494 100644 (file)
@@ -483,14 +483,14 @@ main(int argc, char *argv[])
     sigaction(SIGTERM, &act, NULL);
 
     /* Instead of fiddling with termios.. */
-    system("stty -echo");
+    (void) system("stty -echo");
 
     ret = loop(kbds);
     if (ret)
         goto err_stty;
 
 err_stty:
-    system("stty echo");
+    (void) system("stty echo");
     free_keyboards(kbds);
 err_compose:
     xkb_compose_table_unref(compose_table);
index d72000438423e63fb3b9e6c008b4f689e40dec7e..34ad654b0b66886c9bd62d2720516d072c14df2c 100644 (file)
@@ -372,9 +372,9 @@ main(int argc, char *argv[])
         goto err_core_kbd;
     }
 
-    system("stty -echo");
+    (void) system("stty -echo");
     ret = loop(conn, &core_kbd);
-    system("stty echo");
+    (void) system("stty echo");
 
 err_core_kbd:
     deinit_kbd(&core_kbd);