reduce gcc-normal warnings using casts (no object change)

Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
This commit is contained in:
Thomas E. Dickey 2020-04-21 18:13:22 -04:00
parent 68c72a7341
commit 53b59ddfc1
No known key found for this signature in database
GPG key ID: 702353E0F7E48EDB

View file

@ -447,15 +447,15 @@ extern LockInfoPtr _Xglobal_lock;
*/
#if defined(MALLOC_0_RETURNS_NULL) || defined(__clang_analyzer__)
# define Xmalloc(size) malloc(((size) == 0 ? 1 : (size)))
# define Xrealloc(ptr, size) realloc((ptr), ((size) == 0 ? 1 : (size)))
# define Xcalloc(nelem, elsize) calloc(((nelem) == 0 ? 1 : (nelem)), (elsize))
# define Xmalloc(size) malloc((size_t)((size) == 0 ? 1 : (size)))
# define Xrealloc(ptr, size) realloc((ptr), (size_t)((size) == 0 ? 1 : (size)))
# define Xcalloc(nelem, elsize) calloc((size_t)((nelem) == 0 ? 1 : (nelem)), (size_t)(elsize))
#else
# define Xmalloc(size) malloc((size))
# define Xrealloc(ptr, size) realloc((ptr), (size))
# define Xcalloc(nelem, elsize) calloc((nelem), (elsize))
# define Xmalloc(size) malloc((size_t)(size))
# define Xrealloc(ptr, size) realloc((ptr), (size_t)(size))
# define Xcalloc(nelem, elsize) calloc((size_t)(nelem), (size_t)(elsize))
#endif