Re: [xml] xmlCleanupParser() question / patch

Hmm ... but this point of view would mean that the whole mechanism for this
function is bad for a shared-lib environment, no matter how it's called.

So I could think of this:
* xmlInitParser() and xmlCleanupParser() get deprecated (via the various
compiler specific attributes)
* xmlInitParser() is left the same as now
* xmlCleanupParser() is made a noop
* New Functions xmlInitLibrary() and xmlCleanupLibrary() that have one
additional treat: They maintain a counter, so that each call to
xmlInitLibrary() must be matched by a call to xmlCleanupLibrary() and only
if the counter reaches zero in the cleanup function is the cleanup actually
performed. This way the shared lib problem would go away if all shared libs
are well-behaved.

Would this make sense?

Martin, basically that is the extra pains we had to go through with
our own RAII wrappers.  It would be a nice feature so now a third
party writing a library that hooks into our frame work can use the
libxml2 api directly vs. having to know how to init libxml a 'special'
way when writing code in our framework.

We would welcome the mechanism Martin proposed.


xml mailing list, project page
xml gnome org

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