diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2022-12-10 13:49:56 -0800 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2022-12-11 15:36:06 -0800 |
commit | e02e32f71f6c24fcc69bdaf58f6f9e973a017896 (patch) | |
tree | 942bf0f4eafd2fac63249fb0250c4867403abde5 /utils.h | |
parent | 75af06f5f8ffc41fabd100253aad222cb4ab8662 (diff) | |
download | xorg-app-xkbcomp-e02e32f71f6c24fcc69bdaf58f6f9e973a017896.tar.gz |
Replace uTypedRealloc() with direct reallocarray() calls
Falls back to realloc() if platform doesn't offer reallocarray().
Also removes uRealloc() since it had no other uses.
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Diffstat (limited to 'utils.h')
-rw-r--r-- | utils.h | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -76,9 +76,10 @@ typedef int Comparison; /***====================================================================***/ -extern Opaque uRealloc(Opaque /* old */ , - unsigned /* newSize */ - ); +#ifndef HAVE_REALLOCARRAY +#define reallocarray(p, n, s) realloc(p, (n) * (s)) +#endif + extern Opaque uRecalloc(Opaque /* old */ , unsigned /* nOld */ , unsigned /* nNew */ , @@ -87,7 +88,6 @@ extern Opaque uRecalloc(Opaque /* old */ , extern void uFree(Opaque /* ptr */ ); -#define uTypedRealloc(pO,n,t) ((t *)uRealloc((Opaque)pO,((unsigned)n)*sizeof(t))) #define uTypedRecalloc(pO,o,n,t) ((t *)uRecalloc((Opaque)pO,((unsigned)o),((unsigned)n),sizeof(t))) /***====================================================================***/ |