]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
vsnprintf: collapse the number format state into one single state
authorLinus Torvalds <torvalds@linux-foundation.org>
Thu, 19 Dec 2024 21:52:53 +0000 (13:52 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Mon, 23 Dec 2024 19:18:36 +0000 (11:18 -0800)
commit8d4826cc8a8aca01a3b5e95438dfc0eb3bd589ab
treecbfbd34721a4a5af6bf2646bda3efbdffa429482
parent2b76e39fca4739a75c9a4f96f3471af6b1c18d9e
vsnprintf: collapse the number format state into one single state

We'll squirrel away the size of the number in 'struct fmt' instead.

We have two fairly separate state structures: the 'decode state' is in
'struct fmt', while the 'printout format' is in 'printf_spec'.  Both
structures are small enough to pass around in registers even across
function boundaries (ie two words), even on 32-bit machines.

The goal here is to avoid the case statements on the format states,
which generate either deep conditionals or jump tables, while also
keeping the state size manageable.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
lib/vsprintf.c