[Pixman] [PATCH 1/9] lowlevel-blt-bench: move usage to a function

Pekka Paalanen ppaalanen at gmail.com
Wed Jun 10 06:32:50 PDT 2015


From: Pekka Paalanen <pekka.paalanen at collabora.co.uk>

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 at collabora.co.uk>
---
 test/lowlevel-blt-bench.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/test/lowlevel-blt-bench.c b/test/lowlevel-blt-bench.c
index aff4608..69202ee 100644
--- a/test/lowlevel-blt-bench.c
+++ b/test/lowlevel-blt-bench.c
@@ -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;
     }
 
-- 
2.3.6



More information about the Pixman mailing list