diff options
author | Rhodri James <rhodri@kynesim.co.uk> | 2017-07-27 14:45:42 +0100 |
---|---|---|
committer | Rhodri James <rhodri@kynesim.co.uk> | 2017-07-27 14:45:42 +0100 |
commit | f1757d026941358c8668683190e19432c4817ef9 (patch) | |
tree | adf5e23739edc4271e41c921db043e8e026f5d02 /expat | |
parent | a9332c0b4574e836f6bf0296c3b08734846e0646 (diff) | |
download | libexpat-git-f1757d026941358c8668683190e19432c4817ef9.tar.gz |
Use named constant for magic number in test_misc_alloc_create_parser()
Diffstat (limited to 'expat')
-rw-r--r-- | expat/tests/runtests.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/expat/tests/runtests.c b/expat/tests/runtests.c index f43f4401..63674840 100644 --- a/expat/tests/runtests.c +++ b/expat/tests/runtests.c @@ -7610,9 +7610,10 @@ START_TEST(test_misc_alloc_create_parser) { XML_Memory_Handling_Suite memsuite = { duff_allocator, realloc, free }; unsigned int i; +#define MAX_ALLOC_COUNT 10 /* Something this simple shouldn't need more than 10 allocations */ - for (i = 0; i < 10; i++) + for (i = 0; i < MAX_ALLOC_COUNT; i++) { allocation_count = i; parser = XML_ParserCreate_MM(NULL, &memsuite, NULL); @@ -7621,9 +7622,10 @@ START_TEST(test_misc_alloc_create_parser) } if (i == 0) fail("Parser unexpectedly ignored failing allocator"); - else if (i == 10) - fail("Parser not created with allocation count 10"); + else if (i == MAX_ALLOC_COUNT) + fail("Parser not created with max allocation count"); } +#undef MAX_ALLOC_COUNT END_TEST /* Test memory allocation failures for a parser with an encoding */ |