lowlevel-blt-bench: move usage to a function
authorPekka Paalanen <pekka.paalanen@collabora.co.uk>
Wed, 10 Jun 2015 08:14:38 +0000 (11:14 +0300)
committerPekka Paalanen <pekka.paalanen@collabora.co.uk>
Mon, 6 Jul 2015 09:03:28 +0000 (12:03 +0300)
Move printing of usage into a new function and use argv[0] as the
program name. This will help printing usage from multiple places.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Ben Avison <bavison@riscosopen.org>
test/lowlevel-blt-bench.c

index aff46087405cededf89bc9d8e17ab80e3b439769..69202eef4131afa1424cc2bb049cdd868529709a 100644 (file)
@@ -976,6 +976,14 @@ run_default_tests (double bandwidth_)
         run_one_test (tests_tbl[i].testname, bandwidth_);
 }
 
+static void
+usage (const char *progname)
+{
+    printf ("Usage: %s [-b] [-n] pattern\n", progname);
+    printf ("  -n : benchmark nearest scaling\n");
+    printf ("  -b : benchmark bilinear scaling\n");
+}
+
 int
 main (int argc, char *argv[])
 {
@@ -1005,9 +1013,7 @@ main (int argc, char *argv[])
 
     if (!pattern)
     {
-       printf ("Usage: lowlevel-blt-bench [-b] [-n] pattern\n");
-       printf ("  -n : benchmark nearest scaling\n");
-       printf ("  -b : benchmark bilinear scaling\n");
+       usage (argv[0]);
        return 1;
     }