On Fri Oct 25 21:18:34 2024 +0000, Fabian Maurer wrote:
The function sets a global variable, and that has a comment to use `xmlSaveSetIndentString`. Problem 1: This function doesn't exist in the current version Problem 2: We need to set in in `domdoc.c:doparse`, it is later used inside `xmlsave.c:xmlNodeDumpOutput`, but this function makes its own save context, and we can't configure that one... In short, I currently don't see a better way than setting it globally with the deprecated function.
If I'm reading the source code correctly, that is almost correct. Yes, the function makes a save context - but first, it checks if there is one, and if yes, it keeps that.
If you're sure that everything calling xmlNodeDumpOutput goes via doparse, you can create and configure a save context in doparse. The context is created as soon as it's referenced; simply write to xmlTreeIndentString, it's a macro expanding to a function call that allocates if needed. Then you don't need the write in DllMain anymore.
(Yes, it's horrifying.)