git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Martin Ågren" <martin.agren@gmail.com>
To: Patrick Steinhardt <ps@pks.im>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 5/8] pretty: after padding, reset padding info
Date: Thu, 20 Mar 2025 17:11:31 +0100	[thread overview]
Message-ID: <CAN0heSovtPNpyHEUC8m48zyJkRxGQNwp5u6x=WDMdd+aNJnwjw@mail.gmail.com> (raw)
In-Reply-To: <Z9vdTmVbIJLa9PGO@pks.im>

On Thu, 20 Mar 2025 at 10:18, Patrick Steinhardt <ps@pks.im> wrote:
>
> On Wed, Mar 19, 2025 at 08:23:38AM +0100, Martin Ågren wrote:

> Yeah, I agree. It's very surprising that we retain only a subset of
> state, and that does feel like a bug to me.
>
> >       c->pad.flush_type = no_flush;
> > +     c->pad.truncate = trunc_none;
> > +     c->pad.padding = 0;
> >       return total_consumed;
> >  }
>
> This is using the same default values now as you started to use in the
> preceding commit. It might make sense to introduce a macro or function
> to initialize the structure so that we don't duplicate initialization.

Good point. I'll make the preceding commit use a new
`padding_args_clear()`, then reuse it here.

BTW, we rely on initializing the struct with all-zeroes to put it in
this cleared state. Which is true, since the "none"/"no" enum members
are indeed zero. That's not explicit though. I'm thinking of adding a
preparatory patch to make `no_flush` and `trunc_none` be explicitly
zero, and see if there are other such enum values in this file.


Martin

  reply	other threads:[~2025-03-20 16:12 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-19  7:23 [PATCH 0/8] pretty: minor bugfixing, some refactorings Martin Ågren
2025-03-19  7:23 ` [PATCH 1/8] pretty: tighten function signature to not take `void *` Martin Ågren
2025-03-20  9:18   ` Patrick Steinhardt
2025-03-19  7:23 ` [PATCH 2/8] pretty: simplify if-else to reduce code duplication Martin Ågren
2025-03-20  9:17   ` Patrick Steinhardt
2025-03-20 16:10     ` Martin Ågren
2025-03-24  3:50   ` Jeff King
2025-03-19  7:23 ` [PATCH 3/8] pretty: collect padding-related fields in separate struct Martin Ågren
2025-03-19  7:23 ` [PATCH 4/8] pretty: fix parsing of half-valid "%<" and "%>" placeholders Martin Ågren
2025-03-20  9:18   ` Patrick Steinhardt
2025-03-20 16:11     ` Martin Ågren
2025-03-24 10:10       ` Patrick Steinhardt
2025-03-19  7:23 ` [PATCH 5/8] pretty: after padding, reset padding info Martin Ågren
2025-03-20  9:18   ` Patrick Steinhardt
2025-03-20 16:11     ` Martin Ågren [this message]
2025-03-19  7:23 ` [PATCH 6/8] pretty: refactor parsing of line-wrapping "%w" placeholder Martin Ågren
2025-03-20  9:18   ` Patrick Steinhardt
2025-03-20 16:11     ` Martin Ågren
2025-03-19  7:23 ` [PATCH 7/8] pretty: refactor parsing of magic Martin Ågren
2025-03-20  9:18   ` Patrick Steinhardt
2025-03-20 16:12     ` Martin Ågren
2025-03-19  7:23 ` [PATCH 8/8] pretty: refactor parsing of decoration options Martin Ågren

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAN0heSovtPNpyHEUC8m48zyJkRxGQNwp5u6x=WDMdd+aNJnwjw@mail.gmail.com' \
    --to=martin.agren@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=ps@pks.im \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).