chiark / gitweb /
tree-wide: use STRLEN() to allocate buffer of constant size
authorThomas Haller <thaller@redhat.com>
Wed, 13 Dec 2017 07:41:11 +0000 (08:41 +0100)
committerSven Eden <yamakuzure@gmx.net>
Wed, 13 Dec 2017 07:41:11 +0000 (08:41 +0100)
commitb4def29b8a9745ca45601058e76401a29db9dd2d
tree9ca5dc2cc928429e319ac49dda3805d1bd302a27
parent8f0c163245883ed1e1fb1fb9b7bc65443e5ff01f
tree-wide: use STRLEN() to allocate buffer of constant size

Using strlen() to declare a buffer results in a variable-length array,
even if the compiler likely optimizes it to be a compile time constant.

When building with -Wvla, certain versions of gcc complain about such
buffers. Compiling with -Wvla has the advantage of preventing variably
length array, which defeat static asserts that are implemented by
declaring an array of negative length.
src/basic/fd-util.c