[PATCH rendercheck 3/4] Don't fail to find the a8r8g8b8 format pointlessly

Adam Jackson ajax at redhat.com
Mon Mar 14 19:09:03 UTC 2016


Without this, trying to test eg. just r5g6b5 would fail, because we'd
ignore anything we didn't whitelist.

Signed-off-by: Adam Jackson <ajax at redhat.com>
---
 tests.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/tests.c b/tests.c
index cca96b4..9c8adaf 100644
--- a/tests.c
+++ b/tests.c
@@ -279,6 +279,11 @@ create_formats_list(Display *dpy)
 
 	describe_format(&formats[nformats].name, NULL, format);
 
+	if (format == XRenderFindStandardFormat(dpy, PictStandardARGB32))
+	{
+	    argb32index = nformats;
+	}
+
 	if (format_whitelist_len != 0) {
 	    bool ok = false;
 	    int j;
@@ -292,17 +297,14 @@ create_formats_list(Display *dpy)
 	    if (!ok) {
 		printf("Ignoring server-supported format: %s\n",
 		       formats[nformats].name);
-		free(formats[nformats].name);
-		formats[nformats].name = NULL;
+		if (nformats != argb32index) {
+		    free(formats[nformats].name);
+		    formats[nformats].name = NULL;
+		}
 		continue;
 	    }
 	}
 
-	if (format == XRenderFindStandardFormat(dpy, PictStandardARGB32))
-	{
-	    argb32index = nformats;
-	}
-
 	printf("Found server-supported format: %s\n", formats[nformats].name);
 
 	nformats++;
-- 
2.5.0



More information about the xorg-devel mailing list