On Fri Oct 25 21:31:04 2024 +0000, Alfred Agrell wrote:
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.)
I guess setting `xmlTreeIndentString = "\t";` works, but I'm not sure if that's the only places where it's need.
Also, not sure what you mean by "create and configure a save context in doparse", it is automatically setup in xmlNodeDumpOutput, and setting xmlTreeIndentString is enough for that to work.