Re: [PATCH] Add pretty-printed XML output option - Mailing list pgsql-hackers

From Jim Jones
Subject Re: [PATCH] Add pretty-printed XML output option
Date
Msg-id 29ec1b21-1113-403c-bd00-b5009d9c4fdb@uni-muenster.de
Whole thread Raw
In response to [PATCH] Add pretty-printed XML output option  (Jim Jones <jim.jones@uni-muenster.de>)
Responses Re: [PATCH] Add pretty-printed XML output option
List pgsql-hackers
On 22.05.25 01:48, Tom Lane wrote:
> I did look at that one too.  I think it's fine, because we're
> dealing with a newly-created document which can't have a root node
> yet.  (Reinforcing this, Valgrind sees no leaks after applying
> my patch.)  I considered adding an assertion that that call returns
> NULL, but concluded that it wasn't worth the notational hassle.
> I'm not strongly set on that conclusion, though, if you think
> differently.


I see. In that case I believe that at least a different comment
explaining this decision would avoid confusion. Something like

/*
 * This attaches root to doc, so we do not need to free it separately.
 * The return value of xmlDocSetRootElement (xmlNodePtr) is intentionally
 * ignored here, as it is guaranteed to be NULL in this specific context.
 * When using this function elsewhere, ensure to handle the return value
 * properly.
 */


Best regards, Jim





pgsql-hackers by date:

Previous
From: Laurenz Albe
Date:
Subject: Re: Retiring some encodings?
Next
From: Srinath Reddy Sadipiralla
Date:
Subject: Re: [Util] Warn and Remove Invalid GUCs