summaryrefslogtreecommitdiff
path: root/lib/string_helpers.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2022-05-01 03:05:14 -0400
committerKent Overstreet <kent.overstreet@linux.dev>2022-10-03 22:52:21 -0400
commitd867c3cf616f88d5e53169b37b2e526edca605dd (patch)
tree0db680ec005e7422c0ffaa56a1126e8076946fd5 /lib/string_helpers.c
parent7fe3c10cf78d25caad3089378ed5fd2fd7772bc4 (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>
Diffstat (limited to 'lib/string_helpers.c')
0 files changed, 0 insertions, 0 deletions