shared: add str_printf() 26/28026/1
authorMarius Vlad <marius.vlad@collabora.com>
Mon, 19 Sep 2022 19:56:43 +0000 (22:56 +0300)
committerMarius Vlad <marius.vlad@collabora.com>
Thu, 22 Sep 2022 11:28:47 +0000 (14:28 +0300)
commit86146a4e7455769d2057ff886c1f9ea7a67d84c2
tree099b2da5aeb59454ea2c53a9a9a4f52ffe78ea99
parent1b93121761e16117d1926e8d57bad17cc5b2701a
shared: add str_printf()

asprintf() has the problem that it leaves *strp undefined when it
fails. Here is a simple wrapper that ensures NULL if asprintf() fails,
which is much more convenient to use.

This will be useful in future patches, where one needs to return error
messages from maybe failing functions, and more.

Bug-AGL: SPEC-4510

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: I2e689551797da525d110a51b02fd608c9e07c567
shared/string-helpers.h