Skip to content

mprintf: fix flag handling and add tests for those#21398

Closed
bagder wants to merge 2 commits intomasterfrom
bagder/printf-flags
Closed

mprintf: fix flag handling and add tests for those#21398
bagder wants to merge 2 commits intomasterfrom
bagder/printf-flags

Conversation

@bagder
Copy link
Copy Markdown
Member

@bagder bagder commented Apr 21, 2026

Follow-up to 4e0bfd8

bagder added 2 commits April 21, 2026 14:33
As 'flags' may already have been set to something when
parse_conversion() is called, make sure to only OR the new flags.

Follow-up to 4e0bfd8
Remove superfluous and never-built test code for systems with 16-bit and
64-bit ints and 16-bit longs, as we don't know any such.
@github-actions github-actions bot added the tests label Apr 21, 2026
@bagder bagder requested a review from Copilot April 21, 2026 13:12
@bagder bagder marked this pull request as ready for review April 21, 2026 13:18
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adjusts curl_mprintf’s conversion parsing to preserve already-parsed flags when applying conversion-specific flags, and extends the existing libtest coverage to exercise + flag handling for unsigned/octal/hex conversions.

Changes:

  • Fix parse_conversion() to OR in conversion-implied flags instead of overwriting the working flag set.
  • Refactor/relocate common test helpers in lib557.c and simplify some type-size conditionals.
  • Add new formatting tests covering + with %u, %o, %x, %X (and long variants).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
tests/libtest/lib557.c Adds new +-flag test cases and rearranges helper routines for reuse across tests.
lib/mprintf.c Ensures conversion-specific flags are applied without clobbering existing parsed flags.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/libtest/lib557.c
Comment thread tests/libtest/lib557.c
@bagder bagder closed this in 4f7e323 Apr 21, 2026
@bagder bagder deleted the bagder/printf-flags branch April 21, 2026 13:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

2 participants