Re: [xml] returning existing handler in xmlNewCharEncodingHandler



On Tue, Feb 10, 2004 at 01:12:02PM +0100, Igor Zlatkovic wrote:
Daniel Veillard wrote:

On Tue, Feb 10, 2004 at 11:50:02AM +0100, oliverst online de wrote:

patch against encoding.c version 1.77 as discussed with Igor on the list

1233a1234,1241

   * Check for existing handler
   */
  handler = xmlFindCharEncodingHandler(name);

  if (handler != NULL)
      return(handler);

  /*

So long


 Hum, I might disagree with Igor on this, but it seems to me that
it might be better to call xmlFindCharEncodingHandler() before
calling xmlNewCharEncodingHandler(), rather than changing the semantic
of the existing call. In any case in a multithreaded program it seems
to me that you need to ensure some critical section when changing the
default handlers for an encoding. Usually this is best done at program
startup, but I may have missed something, sorry I couldn't participate
to last week discussion, but after rereading the archive I'm not sure
changing the behaviour is the best thing to do.

I agreed to the patch for the following reason.

The patch will change the behaviour of xmlNewCharEncodingHandler(), but 
not that of xmlFindCharEncodingHandler(). The idea was to prevent the 
registration of more than one handler for the same encoding name. That 

  Ah, okay ! I missed that, I'm applying the patch,

    thanks,

Daniel

-- 
Daniel Veillard      | Red Hat Network https://rhn.redhat.com/
veillard redhat com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]