]> git.ipfire.org Git - thirdparty/systemd.git/commit - src/nspawn/nspawn.c
string-util: add strextendf() helper, that allows extending some allocated string...
authorLennart Poettering <lennart@poettering.net>
Wed, 5 May 2021 07:56:46 +0000 (09:56 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 7 May 2021 07:10:59 +0000 (09:10 +0200)
commite9b88a6d4ec7818a334ee12f50f23706bcc3c7e0
tree7e7ade7b26ad2cd5459ea8a9d17c695859c9f155
parentdb1ce3ea1a59b3af5ff2029e4514c7e82f5b94d3
string-util: add strextendf() helper, that allows extending some allocated string via a format string

It's not going to be efficient if called in inner loops, but it's oh so
handy, and we have some code that does this:

   asprintf(&p, "%s…", b, …);
   free(b);
   b = TAKE_PTR(p);

which can now be replaced by the quicker and easier to read:

   strextendf(&p, "…", …);
src/basic/string-util.c
src/basic/string-util.h
src/nspawn/nspawn.c
src/test/test-string-util.c