]> git.ipfire.org Git - thirdparty/systemd.git/commit
alloc-util: add new helpers memdup_suffix0() and newdup_suffix0()
authorLennart Poettering <lennart@poettering.net>
Thu, 20 Jul 2017 12:14:55 +0000 (14:14 +0200)
committerLennart Poettering <lennart@poettering.net>
Mon, 31 Jul 2017 16:20:28 +0000 (18:20 +0200)
commitc165d97d16f24c9c28d9574ed82b3a6669408ca5
treeea76f32ddd66fad78c58d36e26af1784740d34b0
parent7bf7ce28b5a1f589f0f2382e54c03ab9b0794fab
alloc-util: add new helpers memdup_suffix0() and newdup_suffix0()

These are similar to memdup() and newdup(), but reserve one extra NUL
byte at the end of the new allocation and initialize it. It's useful
when copying out data from fixed size character arrays where NUL
termination can't be assumed.
src/basic/alloc-util.c
src/basic/alloc-util.h
src/shared/logs-show.c