]> granicus.if.org Git - libexpat/commitdiff
Use named constant for magic number in test_alloc_explicit_encoding()
authorRhodri James <rhodri@kynesim.co.uk>
Thu, 27 Jul 2017 12:09:54 +0000 (13:09 +0100)
committerRhodri James <rhodri@kynesim.co.uk>
Thu, 27 Jul 2017 12:09:54 +0000 (13:09 +0100)
expat/tests/runtests.c

index 0a37d223f1dd2351f44d478c4bf704b1474dbf6d..af50cd3fd8ed3889885770b7de6897933f614bc8 100644 (file)
@@ -8524,17 +8524,19 @@ END_TEST
 START_TEST(test_alloc_explicit_encoding)
 {
     int i;
+#define MAX_ALLOC_COUNT 5
 
-    for (i = 0; i < 5; i++) {
+    for (i = 0; i < MAX_ALLOC_COUNT; i++) {
         allocation_count = i;
         if (XML_SetEncoding(parser, "us-ascii") == XML_STATUS_OK)
             break;
     }
     if (i == 0)
         fail("Encoding set despite failing allocator");
-    else if (i == 5)
-        fail("Encoding not set at allocation count 5");
+    else if (i == MAX_ALLOC_COUNT)
+        fail("Encoding not set at max allocation count");
 }
+#undef MAX_ALLOC_COUNT
 END_TEST
 
 /* Test robustness of XML_SetBase against a failing allocator */