RE: [xml] [Q] libxml-2.2.2.3 Thread Safe ?

Date view Thread view Subject view Author view

From: Marc Sanfacon (sanm@copernic.com)
Date: Thu Sep 28 2000 - 17:18:50 EDT


>> int htmlParseDocument(htmlParserCtxtPtr ctxt) {
>> xmlDtdPtr dtd;
>>
>> htmlDefaultSAXHandlerInit();
>>
>> Is another place. Why do we need to initalize 'htmlDefaultSAXHandler'
here
>> ? It was already initialized when instantiated.

> Well since htmlParserCtxtPtr if a public structure there it is not
>formally forbidden to enter here without having called any of the context
>initialization routines.

I agree with you, but 'htmlDefaultSAXHandler' will be initialized anyway
since it is declared like this:

xmlSAXHandler htmlDefaultSAXHandler = {
    internalSubset,
    NULL,
    NULL,
    NULL,
    NULL,
    getEntity,
    NULL,
    NULL,
    NULL,
    NULL,
    NULL,
    setDocumentLocator,
    startDocument,
    endDocument,
    startElement,
    endElement,
    NULL,
    characters,
    ignorableWhitespace,
    NULL,
    comment,
    xmlParserWarning,
    xmlParserError,
    xmlParserError,
    getParameterEntity,
    NULL,
    NULL,
};

Of course, if someone changed the default value, then we have a problem...
But it the default value was changed, it is not taken into account in this
call, since the default values are resetted. So maybe we should remove this
function call from there and leave it there. So if people want to reset to
the default, after having modified it, they can call this function.

Is it logical ? Will it break existing code ?

>> Of course, As I said, since I call the parser in ST first, some of the
bugs
>> might be there also. It would be a good idea to have an initialization
>> routine available, so I could call it when starting the system and ensure
>> all the globals variables are initialized.

> Yes, this is the best way to handle this in threaded contexts.
>We just need to define xmlInitParser() (like was done for cleanup
>xmlCleanupParser() ) and probably an HTML counterpart.
>
> I will look at this, either tonight or during this w.e.

Excellent.
Thank you.

Marc.

----
Message from the list xml@rpmfind.net
Archived at : http://xmlsoft.org/messages/
to unsubscribe: echo "unsubscribe xml" | mail  majordomo@rpmfind.net


Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Thu Sep 28 2000 - 17:43:17 EDT