diff options
| author | gingerBill <gingerBill@users.noreply.github.com> | 2025-02-20 08:49:48 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-02-20 08:49:48 +0000 |
| commit | 9dc4d5a4e6bad3b06e8f358d56cbb5f62f71a929 (patch) | |
| tree | c79cff7d58337ffd90795dd655add44cb965bd9c | |
| parent | 82ddf358d0a319ba0eefd838bb80cf526daf9dcb (diff) | |
| parent | dc2c9b5d51a47ff303a7630d0c7a683c87e4b6c2 (diff) | |
Merge pull request #4845 from Barinzaya/fmt_variable_wp_without_index
Variable Width/Precision Without Index in `fmt`
| -rw-r--r-- | core/fmt/fmt.odin | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/core/fmt/fmt.odin b/core/fmt/fmt.odin index 51e70f6b7..2fe6d3350 100644 --- a/core/fmt/fmt.odin +++ b/core/fmt/fmt.odin @@ -613,6 +613,10 @@ wprintf :: proc(w: io.Writer, fmt: string, args: ..any, flush := true, newline : i += 1 width_index, _, index_ok := _arg_number(fmt, &i, len(args)) + if !index_ok { + width_index, index_ok = error_check_arg(fi, false, unused_args^) + } + if index_ok { unused_args^ -= {width_index} @@ -638,6 +642,10 @@ wprintf :: proc(w: io.Writer, fmt: string, args: ..any, flush := true, newline : i += 1 precision_index, _, index_ok := _arg_number(fmt, &i, len(args)) + if !index_ok { + precision_index, index_ok = error_check_arg(fi, false, unused_args^) + } + if index_ok { unused_args^ -= {precision_index} fi.prec, _, fi.prec_set = int_from_arg(args, precision_index) |