summaryrefslogtreecommitdiff
path: root/utils.h
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2022-12-10 13:49:56 -0800
committerAlan Coopersmith <alan.coopersmith@oracle.com>2022-12-11 15:36:06 -0800
commite02e32f71f6c24fcc69bdaf58f6f9e973a017896 (patch)
tree942bf0f4eafd2fac63249fb0250c4867403abde5 /utils.h
parent75af06f5f8ffc41fabd100253aad222cb4ab8662 (diff)
downloadxorg-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.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/utils.h b/utils.h
index 68ec887..36f9e2a 100644
--- a/utils.h
+++ b/utils.h
@@ -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)))
/***====================================================================***/