diff options
| author | Takashi Kokubun <takashikkbn@gmail.com> | 2026-03-31 17:18:42 -0700 |
|---|---|---|
| committer | Takashi Kokubun <takashikkbn@gmail.com> | 2026-03-31 17:24:01 -0700 |
| commit | 1389a36b51542f08cb031bd192d35122a0a70c07 (patch) | |
| tree | 5f2102e07e72e7b13d169a3edf39ac94d6814772 /sprintf.c | |
| parent | 6a5a2612fd6b0b8b707e0285d1a172e01469078c (diff) | |
sprintf.c: Fix -Wmaybe-uninitialized warnings in rb_str_format
Initialize `c` and `encidx` to 0. They are assigned inside
`if (n >= 0)` and the following `if (n <= 0)` calls rb_raise, but the
compiler cannot see through the noreturn guarantee.
Diffstat (limited to 'sprintf.c')
| -rw-r--r-- | sprintf.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -440,8 +440,8 @@ rb_str_format(int argc, const VALUE *argv, VALUE fmt) { VALUE val = GETARG(); VALUE tmp; - unsigned int c; - int n, encidx; + unsigned int c = 0; + int n, encidx = 0; tmp = rb_check_string_type(val); if (!NIL_P(tmp)) { |
