Re: Another issue with invalid XML values
Florian G. Pflug <fgp@phlo.org>
From: Florian Pflug <fgp@phlo.org>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Noah Misch <noah@leadboat.com>, PG Hackers <pgsql-hackers@postgresql.org>
Date: 2011-07-20T15:42:55Z
Lists: pgsql-hackers
On Jul20, 2011, at 17:37 , Tom Lane wrote: > Florian Pflug <fgp@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. You've convinced me, thanks for the detailed explanation! >> 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. Cool, thanks! best regards, Florian Pflug