xnest: Display: fix xallocarray() compiler warning
Compiler warning:
[7/29] Compiling C object hw/xnest/Xnest.p/Display.c.o
In file included from ../include/misc.h:119,
from ../include/screenint.h:50,
from ../hw/xnest/Display.c:24:
../hw/xnest/Display.c: In function ‘xnestOpenDisplay’:
../include/os.h:81:32: warning: argument 2 range [2147483648, 4294967295] exceeds maximum object size 2147483647 [-Walloc-size-larger-than=]
81 | #define xallocarray(num, size) reallocarray(NULL, (num), (size))
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../hw/xnest/Display.c:124:29: note: in expansion of macro ‘xallocarray’
124 | xnestDefaultColormaps = xallocarray(xnestNumDefaultColormaps,
| ^~~~~~~~~~~
In file included from ../include/os.h:54:
/usr/include/stdlib.h:582:14: note: in a call to allocation function ‘reallocarray’ declared here
582 | extern void *reallocarray (void *__ptr, size_t __nmemb, size_t __size)
| ^~~~~~~~~~~~
Since we really don't need more than 2^16 colormaps, using uint16_t here to silence this warning.
Signed-off-by: Enrico Weigelt, metux IT consult info@metux.net
Edited by Alan Coopersmith