Re: Another issue with invalid XML values - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Another issue with invalid XML values
Date
Msg-id 12217.1311176258@sss.pgh.pa.us
Whole thread Raw
In response to Re: Another issue with invalid XML values  (Florian Pflug <fgp@phlo.org>)
Responses Re: Another issue with invalid XML values
List pgsql-hackers
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.

> 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


pgsql-hackers by date:

Previous
From: Florian Pflug
Date:
Subject: Re: Another issue with invalid XML values
Next
From: Florian Pflug
Date:
Subject: Re: Another issue with invalid XML values