lib/pattern: Support NULL output buffer in parse_and_fill_pattern()
authorLogan Gunthorpe <logang@deltatee.com>
Fri, 18 Nov 2022 23:15:57 +0000 (16:15 -0700)
committerVincent Fu <vincent.fu@samsung.com>
Sat, 19 Nov 2022 00:36:10 +0000 (19:36 -0500)
commit6c9397396eb83a6ce64a998795e7a50552e4337e
treebbd3acd1c366924689b76844b8d92575994c12d4
parent7f812e878210490e7fe68b3312fafbd864137165
lib/pattern: Support NULL output buffer in parse_and_fill_pattern()

Support passing a NULL output buffer to parse_and_fill_pattern().
Each formatting function simply needs to avoid accessing the buffer
when it is NULL. This allows calculating the required size of the
buffer before one might be allocated.

This will be useful in a subsequent patch for dynamically allocating
the pattern buffers.

Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
lib/pattern.c