OSDN Git Service

chardev/baum: Use definitions to avoid dynamic stack allocation
authorPhilippe Mathieu-Daudé <philmd@redhat.com>
Fri, 19 Aug 2022 15:39:22 +0000 (16:39 +0100)
committerPeter Maydell <peter.maydell@linaro.org>
Thu, 22 Sep 2022 15:38:28 +0000 (16:38 +0100)
commit1e3acd33576c695262a09262c9319d44a01b11e7
tree8ad2378f4bf21fa0ec499af055112e1eeb7e91b0
parentf63a6e381c48b796c3964accaa88c0d0e229b17f
chardev/baum: Use definitions to avoid dynamic stack allocation

We know 'x * y' will be at most 'X_MAX * Y_MAX' (which is not
a big value, it is actually 84). Instead of having the compiler
use variable-length array, declare an array able to hold the
maximum 'x * y'.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 20220819153931.3147384-3-peter.maydell@linaro.org
chardev/baum.c