diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2022-05-01 03:05:14 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@gmail.com> | 2022-08-08 11:04:44 -0400 |
commit | dbd7df2adeaeec815818b703bb4fadd1d6e400b8 (patch) | |
tree | 3735dad6380759b3c64e5b5326f61862c4298d24 /samples/coresight | |
parent | 299b794fc3f1c3f529a4194586d23f7108cb2cf8 (diff) |
vsprintf: Convert to printbuf
This converts vsnprintf() to printbufs: instead of passing around raw
char * pointers for current buf position and end of buf, we have a real
type!
This makes the calling convention for our existing pretty printers a lot
saner and less error prone, plus printbufs add some new helpers that
make the code smaller and more readable, with a lot less crazy pointer
arithmetic.
There are a lot more refactorings to be done: this patch tries to stick
to just converting the calling conventions, as that needs to be done all
at once in order to avoid introducing a ton of wrappers that will just
be deleted.
Thankfully we have good unit tests for printf, and they have been run
and are all passing with this patch.
We have two new exported functions with this patch:
- prt_printf(), which is like snprintf but outputs to a printbuf
- prt_vprintf, like vsnprintf
These are the actual core print routines now - vsnprintf() is a wrapper
around prt_vprintf().
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Cc: Petr Mladek <pmladek@suse.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Diffstat (limited to 'samples/coresight')
0 files changed, 0 insertions, 0 deletions