From: Rhodri James Date: Thu, 27 Jul 2017 13:29:44 +0000 (+0100) Subject: Make test_alloc_long_public_id() robust vs allocation pattern changes X-Git-Tag: R_2_2_3~16^2~6 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9e8311f127b71563186b5faeb54e01017d0dcbde;p=libexpat Make test_alloc_long_public_id() robust vs allocation pattern changes --- diff --git a/expat/tests/runtests.c b/expat/tests/runtests.c index 28cbc756..d881bffb 100644 --- a/expat/tests/runtests.c +++ b/expat/tests/runtests.c @@ -10046,21 +10046,9 @@ START_TEST(test_alloc_long_public_id) "&e;"; 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 allocation caching */ - if (i == 4 && repeat == 4) { - i -= 2; - repeat++; - } - else if ((i == 2 && repeat < 3) || - (i == 3 && (repeat == 3 || repeat == 5)) || - (i == 4 && repeat == 6)) { - i--; - repeat++; - } allocation_count = i; XML_SetUserData(parser, entity_text); XML_SetParamEntityParsing(parser, XML_PARAM_ENTITY_PARSING_ALWAYS); @@ -10068,7 +10056,9 @@ START_TEST(test_alloc_long_public_id) 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");