]> git.ipfire.org Git - thirdparty/systemd.git/commit
src/basic: add yet another strdup helper
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 15 Mar 2024 12:16:51 +0000 (13:16 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 20 Mar 2024 14:12:12 +0000 (15:12 +0100)
commit892c5902ae11e5b0ca0494411067794d763baf45
treedaa912e42da948c7c4dc9bf7f06a99682a106301
parentfb01ab09d3499b1a2e8aac42ec11213b71d6dd6a
src/basic: add yet another strdup helper

It's a bit ugly to have both strdup_to() and strdup_to_full(). I initially
started with one variant, but then in some functions we want the additional
info, while in many other places, having 1 instead of 0 causes the return
value of whole chains of functions to be changed. It *probably* wouldn't cause
any difference, but there is at least of bunch of tests that would need to be
updated, so in the end it seems to have the two variants.

The output param is first to match free_and_strdup() and other similar
functions.
src/basic/string-util.c
src/basic/string-util.h
src/test/test-string-util.c