[Expat-discuss] is expat a reentrant parser

Michael B. Allen mballen@erols.com
Fri, 3 Aug 2001 23:11:36 -0400


On Fri, Aug 03, 2001 at 08:26:09PM -0400, Fred L. Drake, Jr. wrote:
> 
> Michael B. Allen writes:
>  > I recall seeing a message by James Clark that it is indeed reentrant
>  > but unforunately I don't remember where. This could have been changed
>  > of course. The sourceforge code is considerably different from Clark's
>  > original expat-1.2 source.
> 
>   I would not expect that quality of the code to have changed
> terribly, so I'll say that it *should* still hold.

Maintaining reentrancey is not a matter of quality but rather actively
being conscientious about not modify data outside of the current stack
context. From glancing at the code it does look like everything is
carried with the XML_Parser object. At first glance something like:

void XML_UseParserAsHandlerArg(XML_Parser parser) 
{
  handlerArg = parser; 
}

Looks like setting a global but this, as well as many others like it,
is actually a macro that sets the associated member of the XML_Parser
object so it's ok of course.

#define handlerArg (((Parser *)parser)->m_handlerArg)

Mike