xmlparse.c: Resolve macro "freeTagList" (issue #59)

This commit is contained in:
Sebastian Pipping 2017-09-03 00:54:54 +02:00
parent cde2d9a01e
commit fcb7cf066c

View File

@ -668,7 +668,6 @@ struct XML_ParserStruct {
#define defaultExpandInternalEntities \ #define defaultExpandInternalEntities \
(parser->m_defaultExpandInternalEntities) (parser->m_defaultExpandInternalEntities)
#define buffer (parser->m_buffer) #define buffer (parser->m_buffer)
#define freeTagList (parser->m_freeTagList)
#define freeBindingList (parser->m_freeBindingList) #define freeBindingList (parser->m_freeBindingList)
#define inheritedBindings (parser->m_inheritedBindings) #define inheritedBindings (parser->m_inheritedBindings)
#define tagStack (parser->m_tagStack) #define tagStack (parser->m_tagStack)
@ -1029,7 +1028,7 @@ parserCreate(const XML_Char *encodingName,
} }
freeBindingList = NULL; freeBindingList = NULL;
freeTagList = NULL; parser->m_freeTagList = NULL;
parser->m_freeInternalEntities = NULL; parser->m_freeInternalEntities = NULL;
groupSize = 0; groupSize = 0;
@ -1165,15 +1164,15 @@ XML_ParserReset(XML_Parser parser, const XML_Char *encodingName)
if (parentParser) if (parentParser)
return XML_FALSE; return XML_FALSE;
/* move tagStack to freeTagList */ /* move tagStack to m_freeTagList */
tStk = tagStack; tStk = tagStack;
while (tStk) { while (tStk) {
TAG *tag = tStk; TAG *tag = tStk;
tStk = tStk->parent; tStk = tStk->parent;
tag->parent = freeTagList; tag->parent = parser->m_freeTagList;
moveToFreeBindingList(parser, tag->bindings); moveToFreeBindingList(parser, tag->bindings);
tag->bindings = NULL; tag->bindings = NULL;
freeTagList = tag; parser->m_freeTagList = tag;
} }
/* move m_openInternalEntities to m_freeInternalEntities */ /* move m_openInternalEntities to m_freeInternalEntities */
openEntityList = parser->m_openInternalEntities; openEntityList = parser->m_openInternalEntities;
@ -1416,15 +1415,15 @@ XML_ParserFree(XML_Parser parser)
OPEN_INTERNAL_ENTITY *entityList; OPEN_INTERNAL_ENTITY *entityList;
if (parser == NULL) if (parser == NULL)
return; return;
/* free tagStack and freeTagList */ /* free tagStack and m_freeTagList */
tagList = tagStack; tagList = tagStack;
for (;;) { for (;;) {
TAG *p; TAG *p;
if (tagList == NULL) { if (tagList == NULL) {
if (freeTagList == NULL) if (parser->m_freeTagList == NULL)
break; break;
tagList = freeTagList; tagList = parser->m_freeTagList;
freeTagList = NULL; parser->m_freeTagList = NULL;
} }
p = tagList; p = tagList;
tagList = tagList->parent; tagList = tagList->parent;
@ -2805,9 +2804,9 @@ doContent(XML_Parser parser,
TAG *tag; TAG *tag;
enum XML_Error result; enum XML_Error result;
XML_Char *toPtr; XML_Char *toPtr;
if (freeTagList) { if (parser->m_freeTagList) {
tag = freeTagList; tag = parser->m_freeTagList;
freeTagList = freeTagList->parent; parser->m_freeTagList = parser->m_freeTagList->parent;
} }
else { else {
tag = (TAG *)MALLOC(sizeof(TAG)); tag = (TAG *)MALLOC(sizeof(TAG));
@ -2915,8 +2914,8 @@ doContent(XML_Parser parser,
const char *rawName; const char *rawName;
TAG *tag = tagStack; TAG *tag = tagStack;
tagStack = tag->parent; tagStack = tag->parent;
tag->parent = freeTagList; tag->parent = parser->m_freeTagList;
freeTagList = tag; parser->m_freeTagList = tag;
rawName = s + enc->minBytesPerChar*2; rawName = s + enc->minBytesPerChar*2;
len = XmlNameLength(enc, rawName); len = XmlNameLength(enc, rawName);
if (len != tag->rawNameLength if (len != tag->rawNameLength