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

index af50cd3fd8ed3889885770b7de6897933f614bc8..c13e9d1ca96113a987506564e61058af92823133 100644 (file)
@@ -8544,17 +8544,19 @@ START_TEST(test_alloc_set_base)
 {
     const XML_Char *new_base = "/local/file/name.xml";
     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_SetBase(parser, new_base) == XML_STATUS_OK)
             break;
     }
     if (i == 0)
         fail("Base set despite failing allocator");
-    else if (i == 5)
-        fail("Base not set with allocation count 5");
+    else if (i == MAX_ALLOC_COUNT)
+        fail("Base not set with max allocation count");
 }
+#undef MAX_ALLOC_COUNT
 END_TEST
 
 /* Test buffer extension in the face of a duff reallocator */