Re: Use appendStringInfoSpaces more

2023-01-19 Thread David Rowley
On Fri, 20 Jan 2023 at 10:23, Peter Smith wrote: > Should the add_indent function also have a check to avoid making > unnecessary calls to appendStringInfoSpaces when the level is 0? Although I didn't opt to do that, thank you for having a look. I do think the patch is trivially simple and nobod

Re: Use appendStringInfoSpaces more

2023-01-19 Thread David Rowley
On Fri, 20 Jan 2023 at 10:25, Tom Lane wrote: > > Peter Smith writes: > > Should the add_indent function also have a check to avoid making > > unnecessary calls to appendStringInfoSpaces when the level is 0? > > Seems like unnecessary extra notation, seeing that appendStringInfoSpaces > will fall

Re: Use appendStringInfoSpaces more

2023-01-19 Thread Tom Lane
Peter Smith writes: > Should the add_indent function also have a check to avoid making > unnecessary calls to appendStringInfoSpaces when the level is 0? Seems like unnecessary extra notation, seeing that appendStringInfoSpaces will fall out quickly for a zero argument. r

Re: Use appendStringInfoSpaces more

2023-01-19 Thread Peter Smith
On Thu, Jan 19, 2023 at 8:45 PM David Rowley wrote: > > In [1] I noticed a bit of a poor usage of appendStringInfoString which > just appends 4 spaces in a loop, one for each indent level of the > jsonb. It should be better just to use appendStringInfoSpaces and > just append all the spaces in on

Use appendStringInfoSpaces more

2023-01-19 Thread David Rowley
In [1] I noticed a bit of a poor usage of appendStringInfoString which just appends 4 spaces in a loop, one for each indent level of the jsonb. It should be better just to use appendStringInfoSpaces and just append all the spaces in one go rather than appending 4 spaces in a loop. That'll save hav