From: Rhodri James Date: Thu, 27 Jul 2017 12:09:54 +0000 (+0100) Subject: Use named constant for magic number in test_alloc_explicit_encoding() X-Git-Tag: R_2_2_3~16^2~39 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=75e29a7191f0c211107c5394ed36c1cf65216bdc;p=libexpat Use named constant for magic number in test_alloc_explicit_encoding() --- diff --git a/expat/tests/runtests.c b/expat/tests/runtests.c index 0a37d223..af50cd3f 100644 --- a/expat/tests/runtests.c +++ b/expat/tests/runtests.c @@ -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 */