mbox series

[v2,0/6] parse-options: long option parsing fixes and cleanup

Message ID 20240303121944.20627-1-l.s.r@web.de (mailing list archive)
Headers show
Series parse-options: long option parsing fixes and cleanup | expand

Message

René Scharfe March 3, 2024, 12:19 p.m. UTC
Fix two corner cases in patches 1 and 4, refactor the code in patches 2
and 3 to prepare the second fix, bonus patches 5 and 6 simplify the code
and improve readability.

Changes since v1:
* Added sign-off.

  parse-options: recognize abbreviated negated option with arg
  parse-options: set arg of abbreviated option lazily
  parse-options: factor out register_abbrev() and struct parsed_option
  parse-options: detect ambiguous self-negation
  parse-options: normalize arg and long_name before comparison
  parse-options: rearrange long_name matching code

 parse-options.c               | 137 ++++++++++++++++++----------------
 t/t0040-parse-options.sh      |  16 ++++
 t/t1502-rev-parse-parseopt.sh |  11 +++
 3 files changed, 100 insertions(+), 64 deletions(-)

--
2.44.0

Comments

Josh Steadmon March 12, 2024, 9:45 p.m. UTC | #1
On 2024.03.03 13:19, René Scharfe wrote:
> Fix two corner cases in patches 1 and 4, refactor the code in patches 2
> and 3 to prepare the second fix, bonus patches 5 and 6 simplify the code
> and improve readability.
> 
> Changes since v1:
> * Added sign-off.
> 
>   parse-options: recognize abbreviated negated option with arg
>   parse-options: set arg of abbreviated option lazily
>   parse-options: factor out register_abbrev() and struct parsed_option
>   parse-options: detect ambiguous self-negation
>   parse-options: normalize arg and long_name before comparison
>   parse-options: rearrange long_name matching code
> 
>  parse-options.c               | 137 ++++++++++++++++++----------------
>  t/t0040-parse-options.sh      |  16 ++++
>  t/t1502-rev-parse-parseopt.sh |  11 +++
>  3 files changed, 100 insertions(+), 64 deletions(-)
> 
> --
> 2.44.0
> 
> 

This series is a good cleanup of some code that at least to me was hard
to figure out on first read. Thanks for the series!

Reviewed-by: Josh Steadmon <steadmon@google.com>