If an invalid format is given on the command line, print an error
and exit rather than assert.
---
 tests/spec/arb_copy_image/formats.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/tests/spec/arb_copy_image/formats.c 
b/tests/spec/arb_copy_image/formats.c
index e6e98a4..14271d0 100644
--- a/tests/spec/arb_copy_image/formats.c
+++ b/tests/spec/arb_copy_image/formats.c
@@ -185,17 +185,16 @@ static const struct texture_format *
 find_format(const char *str)
 {
        int i;
-       const struct texture_format *format = NULL;
 
        for (i = 0; i < sizeof(formats) / sizeof(*formats); ++i) {
                if (strcmp(str, formats[i].name) == 0) {
-                       format = &formats[i];
-                       break;
+                       return &formats[i];
                }
        }
 
-       assert(format);
-       return format;
+       printf("Unknown format: %s\n", str);
+       exit(1);
+       return NULL;
 }
 
 static bool
-- 
1.9.1

_______________________________________________
Piglit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/piglit

Reply via email to