From d43cbb8b4c76fab005cca80843df4d85dcbbd9a0 Mon Sep 17 00:00:00 2001 From: Rhodri James Date: Thu, 27 Jul 2017 14:30:52 +0100 Subject: [PATCH] Make test_alloc_long_entity_value() robust vs allocation changes --- expat/tests/runtests.c | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/expat/tests/runtests.c b/expat/tests/runtests.c index d881bffb..6109b4c4 100644 --- a/expat/tests/runtests.c +++ b/expat/tests/runtests.c @@ -10096,22 +10096,9 @@ START_TEST(test_alloc_long_entity_value) "&e2;"; char entity_text[] = "Hello world"; int i; -#define MAX_ALLOC_COUNT 20 - int repeat = 0; +#define MAX_ALLOC_COUNT 40 for (i = 0; i < MAX_ALLOC_COUNT; i++) { - /* Repeat certain counts to defeat cached allocations */ - if (i == 5 && repeat == 4) { - i -= 2; - repeat++; - } - else if ((i == 2 && repeat < 3) || - (i == 3 && repeat == 3) || - (i == 4 && repeat == 5) || - (i == 5 && repeat == 6)) { - i--; - repeat++; - } allocation_count = i; XML_SetUserData(parser, entity_text); XML_SetParamEntityParsing(parser, XML_PARAM_ENTITY_PARSING_ALWAYS); @@ -10119,7 +10106,9 @@ START_TEST(test_alloc_long_entity_value) if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text), XML_TRUE) != XML_STATUS_ERROR) break; - XML_ParserReset(parser, NULL); + /* See comment in test_alloc_parse_xdecl() */ + alloc_teardown(); + alloc_setup(); } if (i == 0) fail("Parsing worked despite failing allocations"); -- 2.40.0