[Pixman] [PATCH] lowlevel-blt-bench: make extra arguments an error

Pekka Paalanen ppaalanen at gmail.com
Tue Jul 7 01:35:04 PDT 2015


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

If a user gives multiple patterns or extra arguments, only the last one
was used as the pattern while the former were just ignored. This is a
user error silently converted to something possibly unexpected.

In presence of extra arguments, complain and quit.

Cc: Ben Avison <bavison at riscosopen.org>
Signed-off-by: Pekka Paalanen <pekka.paalanen at collabora.co.uk>
---
 test/lowlevel-blt-bench.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/test/lowlevel-blt-bench.c b/test/lowlevel-blt-bench.c
index fc7472f..28ff669 100644
--- a/test/lowlevel-blt-bench.c
+++ b/test/lowlevel-blt-bench.c
@@ -1122,6 +1122,12 @@ main (int argc, char *argv[])
 	}
 	else
 	{
+	    if (pattern)
+	    {
+		pattern = NULL;
+		printf ("Error: extra arguments given.\n");
+		break;
+	    }
 	    pattern = argv[i];
 	}
     }
-- 
2.3.6



More information about the Pixman mailing list