]> git.ipfire.org Git - thirdparty/systemd.git/commit
core: simplify unit_escape_setting()
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sat, 1 Apr 2023 14:23:47 +0000 (16:23 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 4 Apr 2023 13:18:00 +0000 (15:18 +0200)
commit68ecb48b90bd88c92253729304cac4647e143b8d
treed07105c7b18e0c3ba9fc7350ce921d955b04fc7c
parent4a055e5a3e8c8559c326dd4b3e01edbbcc70a86b
core: simplify unit_escape_setting()

The function had a provision for NULL input, and would return NULL, but that
looks like an error and all callers pass in a non-NULL arg and report oom on
NULL. So assert that the input is non-NULL.

All callers specifed the output buffer, so we can simplify the logic to only
make an allocation if appropriate and change the return type to 'const *'.

No functional change.
src/core/unit.c
src/core/unit.h