Improve pgindent's formatting named fields in struct literals and varidic functions - Mailing list pgsql-hackers

From Andreas Karlsson
Subject Improve pgindent's formatting named fields in struct literals and varidic functions
Date
Msg-id c3327be8-09e2-46a1-88b4-228a339d6916@proxel.se
Whole thread Raw
Responses Re: Improve pgindent's formatting named fields in struct literals and varidic functions
List pgsql-hackers
Hi,

A personal pet peeve of mine has been how pgindent formats struct 
literals with named fields, for example the below:

static RBTNode sentinel =
{
     .color = RBTBLACK,.left = RBTNIL,.right = RBTNIL,.parent = NULL
};

The attached patch fixes the formatting to be nicer:

static RBTNode sentinel =
{
     .color = RBTBLACK, .left = RBTNIL, .right = RBTNIL, .parent = NULL
};

It is currently the only example but I mainly think that is because the 
current formatting looks ugly so we avoid putting struct literals on a 
single line. Plus I have seen this formatting in PostgreSQL extensions.

While fixing this personal annoyance I noticed that my fix also would 
fix the formatting of varidic functions. For example:

-errdetail(const char *fmt,...)
+errdetail(const char *fmt, ...)

What do you think? I think both are clear improvements to the 
readability and that the churn is not big enough to be an issue.

Andreas

Attachment

pgsql-hackers by date:

Previous
From: Zsolt Parragi
Date:
Subject: Re: Fix uninitialized xl_running_xacts padding
Next
From: Andrei Lepikhov
Date:
Subject: Re: Add into REFRESH PUBLICATION parameter exception_behaviour