Florian Pflug <f...@phlo.org> writes: > I'm fine with having pg_xml_init() palloc the state and pg_xml_done() > pfree it, but I'm kinda curious about why you prefer that over making it > the callers responsibility and letting callers use a stack-allocated > struct if they wish to.
We could do it that way, but it would require exposing the struct definition to callers. As I have it coded ATM, the struct is an opaque typedef in xml.h and only known within xml.c, which decouples contrib/xml2 from any changes in it. Another point is that if we changed our minds and went over to a transaction cleanup hook, stack-allocated structs wouldn't work at all. Lastly, even if we did stack-allocate the control struct, the message buffer has to be palloc'd so it can be expanded at need. > Fair enough. Are you going to do that, or do you want me to produce an > updated patch? I can do that, but probably not before the weekend. No, I'm working on it, almost done already. regards, tom lane -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers