Re: [PATCH v2] pretty: add %(decorate[:<options>]) format
- From
Andy Koppe <andy.koppe@gmail.com>
- Date
- Aug 11, 2023, 19:04 UTC
- Message-ID
- <CAHWeT-Zo3nTTGBfJPwNhg50KfLn-GAdpU8WZ96d7fT9_axAQXg@mail.gmail.com>
- In-Reply-To
- <783011d8-53ea-15cb-a9c7-6cb0c15bd5aa@gmail.com>
On Sun, 23 Jul 2023 at 17:26, Phillip Wood wrote:
Show 14 quoted lines
>
> On 19/07/2023 19:16, Glen Choo wrote:
> >> case 'D':
> >> - format_decorations_extended(sb, commit, c->auto_color, "", ", ", "");
> >> + format_decorations(sb, commit, c->auto_color,
> >> + &(struct decoration_options){"", ""});
> >
> > I don't remember if C99 lets you name .prefix and .suffix here, but if
> > so, it would be good to name them. Otherwise it's easy to get the order
> > wrong, e.g. if someone reorders the fields in struct decoration_options.
>
> That's a good suggestion. I think this would be the first use of a
> compound literal in the code base so it would be helpful to mention that
> in the commit message.I've taken the suggestion, but then forgot to mention it in the commit message. Will do in the next round.
Show 5 quoted lines
> We've been depending on C99 for a while now so I'd support adding this > compound literal as a test balloon for compiler support. Ævar reported a > while back that they are supported by IBM xlc, Oracle SunCC and HP/UX's > aCC[1] and back then I looked at NonStop which seemed to offer support > with the right compiler flag.
There are a number of uses of designated initializers already, so hopefully compound literals aren't too much of an extra challenge.
Thanks, Andy