Re: [PATCH] Add pretty-printed XML output option

From: Jim Jones <jim(dot)jones(at)uni-muenster(dot)de>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Peter Smith <smithpb2250(at)gmail(dot)com>, Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>, Nikolay Samokhvalov <samokhvalov(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Andrey Borodin <amborodin86(at)gmail(dot)com>
Subject: Re: [PATCH] Add pretty-printed XML output option
Date: 2025-05-22 08:42:46
Message-ID: 29ec1b21-1113-403c-bd00-b5009d9c4fdb@uni-muenster.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Srinath Reddy Sadipiralla 2025-05-22 08:46:13 Re: [Util] Warn and Remove Invalid GUCs
Previous Message Laurenz Albe 2025-05-22 08:26:33 Re: Retiring some encodings?