summaryrefslogtreecommitdiff
path: root/src/Display.c
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2023-03-03 16:23:20 -0800
committerAlan Coopersmith <alan.coopersmith@oracle.com>2023-03-07 00:06:24 +0000
commitb1b54c50d0e5851d72c1e7aff4057687be2e447e (patch)
tree9f58e135805accd2ce2bd0bf57d19a02c44064e4 /src/Display.c
parent4ece1c842a08c11c1f84b95355801d41cd8435b1 (diff)
Replace XtRealloc() calls with XtReallocArray()
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Diffstat (limited to 'src/Display.c')
-rw-r--r--src/Display.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/src/Display.c b/src/Display.c
index 6b6a24f..879b71a 100644
--- a/src/Display.c
+++ b/src/Display.c
@@ -121,9 +121,9 @@ AddToAppContext(Display *d, XtAppContext app)
if (app->count >= app->max) {
app->max = (short) (app->max + DISPLAYS_TO_ADD);
- app->list = (Display **) XtRealloc((char *) app->list,
- (Cardinal) (((size_t) app->max) *
- sizeof(Display *)));
+ app->list = XtReallocArray(app->list,
+ (Cardinal) app->max,
+ (Cardinal) sizeof(Display *));
}
app->list[app->count++] = d;
@@ -550,10 +550,9 @@ XtDestroyApplicationContext(XtAppContext app)
app->being_destroyed = TRUE;
LOCK_PROCESS;
_XtAppDestroyCount++;
- appDestroyList =
- (XtAppContext *) XtRealloc((char *) appDestroyList,
- (unsigned) ((size_t) _XtAppDestroyCount *
- sizeof(XtAppContext)));
+ appDestroyList = XtReallocArray(appDestroyList,
+ (Cardinal) _XtAppDestroyCount,
+ (Cardinal) sizeof(XtAppContext));
appDestroyList[_XtAppDestroyCount - 1] = app;
UNLOCK_PROCESS;
UNLOCK_APP(app);
@@ -739,10 +738,9 @@ XtCloseDisplay(Display *dpy)
else {
pd->being_destroyed = TRUE;
app->dpy_destroy_count++;
- app->dpy_destroy_list = (Display **)
- XtRealloc((char *) app->dpy_destroy_list,
- (Cardinal) ((size_t) app->dpy_destroy_count *
- sizeof(Display *)));
+ app->dpy_destroy_list = XtReallocArray(app->dpy_destroy_list,
+ (Cardinal) app->dpy_destroy_count,
+ (Cardinal) sizeof(Display *));
app->dpy_destroy_list[app->dpy_destroy_count - 1] = dpy;
}
UNLOCK_APP(app);