The z_prf() function currently allocates a 200-byte buffer on the stack to copy strings into, and then perform left/right alignment and padding. Not only this is a pretty large chunk of stack usage, but this imposes limitations on field width and string length. Also the string is copied not only once but _thrice_ making this code less than optimal. Let's rework the code to get rid of both the field width limit and string length limit, as well as the two extra memory copy instances. While at it, let's fixes printf("%08s", "abcd") which used to produce "0000abcd". Signed-off-by: Nicolas Pitre <npitre@baylibre.com> |
||
---|---|---|
.. | ||
base64 | ||
c_lib | ||
crc | ||
json | ||
mem_alloc | ||
rbtree | ||
ringbuffer | ||
sprintf |