Skip to content

pretty: minor bugfixing, some refactorings

Martin Ågren git 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest8 patches 13 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/8pretty: tighten function signature to not take `void *`pretty.c+1 -21 reply
2/8pretty: simplify if-else to reduce code duplicationpretty.c+2 -43 replies
3/8pretty: collect padding-related fields in separate structpretty.c+23 -190 replies
4/8pretty: fix parsing of half-valid "%<" and "%>" placeholderspretty.c t/t4205-log-pretty-formats.sh+18 -63 replies
5/8pretty: after padding, reset padding infopretty.c t/t4205-log-pretty-formats.sh+11 -02 replies
6/8pretty: refactor parsing of line-wrapping "%w" placeholderpretty.c+76 -442 replies
7/8pretty: refactor parsing of magicpretty.c+42 -272 replies
8/8pretty: refactor parsing of decoration optionspretty.c+30 -220 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/8] pretty: minor bugfixing, some refactorings

Hi,

I've been going through pretty.c with an eye to pulling apart parsing of placeholders and formatting of strings. These are some initial cleanups I've accumulated in the process. I think they should be valuable on their own, even if I eventually abandon the bigger project.

Martin Ågren (8):
pretty: tighten function signature to not take void *
pretty: simplify if-else to reduce code duplication

Two more or less simple cleanups.

pretty: collect padding-related fields in separate struct
pretty: fix parsing of half-valid "%<" and "%>" placeholders
pretty: after padding, reset padding info

Fix a bug or two in parsing and handling of padding placeholders.

pretty: refactor parsing of line-wrapping "%w" placeholder
pretty: refactor parsing of magic
pretty: refactor parsing of decoration options

Further splitting without any intended changes in behavior. These refactorings aren't followed by any patch that actually benefits from them. Still, I do think these end up making the code a tiny bit easier to understand by way of having smaller functions and collecting related pieces of data into smaller structs.

Unless the original authors are (TTBOMK) no longer around, I'm cc-ing them on the individual patches and on this cover letter.

Martin

 pretty.c                      | 300 +++++++++++++++++++++-------------
 t/t4205-log-pretty-formats.sh |  15 ++
 2 files changed, 197 insertions(+), 118 deletions(-)
Signature · 1 line
2.49.0.472.ge94155a9ec