From d3c7a776383e6848cb68f8275781966090217714 Mon Sep 17 00:00:00 2001 From: Rhodri James Date: Thu, 27 Jul 2017 13:11:48 +0100 Subject: [PATCH] Use named constant for magic number in test_alloc_set_base() --- expat/tests/runtests.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/expat/tests/runtests.c b/expat/tests/runtests.c index af50cd3f..c13e9d1c 100644 --- a/expat/tests/runtests.c +++ b/expat/tests/runtests.c @@ -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 */