chiark / gitweb /
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)
committerSven Eden <yamakuzure@gmx.net>
Thu, 20 Jul 2017 12:14:55 +0000 (14:14 +0200)
commit07d8f20b72e7e18c0e06aa152264c1abbdd09609
tree26457609cb1c16562fdf84f9edcf36d4da04a9f3
parent790f5b70827dea5c905c41fe1abdc64ef9269fdc
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