From: Rhodri James Date: Thu, 27 Jul 2017 13:39:32 +0000 (+0100) Subject: Make test_alloc_long_notation() robust vs allocation pattern changes. X-Git-Tag: R_2_2_3~16^2~4 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a9332c0b4574e836f6bf0296c3b08734846e0646;p=libexpat Make test_alloc_long_notation() robust vs allocation pattern changes. --- diff --git a/expat/tests/runtests.c b/expat/tests/runtests.c index 6109b4c4..f43f4401 100644 --- a/expat/tests/runtests.c +++ b/expat/tests/runtests.c @@ -10169,22 +10169,9 @@ START_TEST(test_alloc_long_notation) { NULL, NULL } }; int i; -#define MAX_ALLOC_COUNT 20 - int repeat = 0; +#define MAX_ALLOC_COUNT 40 for (i = 0; i < MAX_ALLOC_COUNT; i++) { - /* Repeat some counts to defeat cached allocations */ - if (i == 5 && repeat == 5) { - i -= 2; - repeat++; - } - else if ((i == 2 && repeat < 3) || - (i == 3 && (repeat == 3 || repeat == 4)) || - (i == 4 && repeat == 6) || - (i == 5 && repeat == 7)) { - i--; - repeat++; - } allocation_count = i; XML_SetUserData(parser, options); XML_SetParamEntityParsing(parser, XML_PARAM_ENTITY_PARSING_ALWAYS); @@ -10193,8 +10180,9 @@ START_TEST(test_alloc_long_notation) XML_TRUE) != XML_STATUS_ERROR) break; - XML_ParserFree(parser); - parser = XML_ParserCreate(NULL); + /* See comment in test_alloc_parse_xdecl() */ + alloc_teardown(); + alloc_setup(); } if (i == 0) fail("Parsing worked despite failing allocations");