xf86drm: Allocate drmDevicePtr's on stack
authorEmil Velikov <emil.velikov@collabora.com>
Tue, 15 May 2018 15:32:10 +0000 (16:32 +0100)
committerEmil Velikov <emil.l.velikov@gmail.com>
Tue, 24 Jul 2018 15:24:31 +0000 (16:24 +0100)
commit95b262f01975d7522cea67d5f5647e45a0152cf5
tree742f19086518df858db4506b745a7536f5ba0796
parentf808fee90dba88d7bb1f2e8091377e4878ad5a4a
xf86drm: Allocate drmDevicePtr's on stack

Currently we dynamically allocate 16 pointers and reallocate more as
needed.

Instead, allocate the maximum number (256) on stack - the number is
small enough and is unlikely to change in the foreseeable future.

This allows us to simplify the error handling and even shed a few bytes
off the final binary.

v2:
 - add a define & description behind the magic 256
 - report error to strerr and skip when over 256 device nodes

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Tested-by: Robert Foss <robert.foss@collabora.com> (v1)
Reviewed-by: Robert Foss <robert.foss@collabora.com>
Reviewed-by: Eric Engestrom <eric@engestrom.ch> (v1)
xf86drm.c