diff options
author | Rhodri James <rhodri@kynesim.co.uk> | 2017-07-27 14:48:41 +0100 |
---|---|---|
committer | Rhodri James <rhodri@kynesim.co.uk> | 2017-07-27 14:48:41 +0100 |
commit | a8a79811d70836fe1fab5b5fff872922993a3142 (patch) | |
tree | 047006a53e50515d56385ab293c95b15c578206a /expat/tests/runtests.c | |
parent | f95017d540da6419f650fc88938c42c060ccb872 (diff) | |
download | libexpat-git-a8a79811d70836fe1fab5b5fff872922993a3142.tar.gz |
Use named constant for magic number in external_entity_duff_loader
Diffstat (limited to 'expat/tests/runtests.c')
-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 658cca8d..45c3a4a9 100644 --- a/expat/tests/runtests.c +++ b/expat/tests/runtests.c @@ -8104,9 +8104,10 @@ external_entity_duff_loader(XML_Parser parser, { XML_Parser new_parser; unsigned int i; +#define MAX_ALLOC_COUNT 10 /* Try a few different allocation levels */ - for (i = 0; i < 10; i++) + for (i = 0; i < MAX_ALLOC_COUNT; i++) { allocation_count = i; new_parser = XML_ExternalEntityParserCreate(parser, context, NULL); @@ -8118,14 +8119,15 @@ external_entity_duff_loader(XML_Parser parser, } if (i == 0) fail("External parser creation ignored failing allocator"); - else if (i == 10) - fail("Extern parser not created with allocation count 10"); + else if (i == MAX_ALLOC_COUNT) + fail("Extern parser not created with max allocation count"); /* Make sure other random allocation doesn't now fail */ allocation_count = ALLOC_ALWAYS_SUCCEED; /* Make sure the failure code path is executed too */ return XML_STATUS_ERROR; +#undef MAX_ALLOC_COUNT } /* Test that external parser creation running out of memory is |