]> git.ipfire.org Git - thirdparty/systemd.git/commit
alloc-util: add MALLOC_ELEMENTSOF() helper
authorLennart Poettering <lennart@poettering.net>
Tue, 18 May 2021 20:30:10 +0000 (22:30 +0200)
committerLennart Poettering <lennart@poettering.net>
Wed, 19 May 2021 14:42:19 +0000 (16:42 +0200)
commit99480504d47c0a6bbb1ac230cc33df12bbd36c54
tree3efde30b90df8730e4798af13b5453f39343a170
parent6df28e1f847d68ad37ffe3f4ff47745b55233861
alloc-util: add MALLOC_ELEMENTSOF() helper

This is a wrapper around malloc_usable_size() but is typesafe, and
divides by the element size.

A test it is also added ensuring what it does it does correcly.
src/basic/alloc-util.h
src/test/test-alloc-util.c