Re: [xml] enhancing the error handling API



Daniel Veillard wrote:

 This would require also adding:
   - registering function both globally and for parsing/validation/xslt
     contexts. This means global or thread specific new variables.

No thread specific variables! Only global ones, this is the point.
You create a global callback which application can replace and
after that, the application will be responsible for handling
threads, etc.
For example, if I am writing a Linux application, then I can use
Linux TLS to store error codes, etc. from my error callback and
later process them in the main code (when LibXML function fails).
If I am writing Windows application then I'll write callback based
on Windows TLS and so on. The point is that LibXML does not
need to deal with TLS on all the platform zoo outwhere.
At the end, if someone really needs threads specific error callbacks
on all platforms, then s/he can write this code and contribute to
LibXML :) It would be very simple to integrate it later.

  Ideally by using top macros inherited from xmlerror.h, it's probably
possible to minimize most of the code changes. Unfortunately C doesn't
have support for macros with varargs ...
You can! You do not want to change/remove the existing error functions.
Which means that old error function simply must calls the new ones.
Of course, some parameters (file, line, etc.) will not be set but this will
help to do migration slowly.

Aleksey







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