diff options
Diffstat (limited to 'src/Selection.c')
-rw-r--r-- | src/Selection.c | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/src/Selection.c b/src/Selection.c index f1ebbd7..618d73b 100644 --- a/src/Selection.c +++ b/src/Selection.c @@ -229,11 +229,8 @@ GetSelectionProperty(Display *dpy) } } propCount = sarray->propCount++; - sarray->list = (SelectionProp) XtRealloc((XtPointer) sarray->list, - (Cardinal) ((size_t) sarray-> - propCount * - sizeof - (SelectionPropRec))); + sarray->list = XtReallocArray(sarray->list, (Cardinal) sarray->propCount, + (Cardinal) sizeof(SelectionPropRec)); (void) snprintf(propname, sizeof(propname), "_XT_SELECTION_%d", propCount); sarray->list[propCount].prop = XInternAtom(dpy, propname, FALSE); sarray->list[propCount].avail = FALSE; @@ -1959,9 +1956,8 @@ AddSelectionRequests(Widget wid, int j = 0; qi->count += count; - req = (QueuedRequest *) XtRealloc((char *) req, - (Cardinal) ((size_t) (start + count) * - sizeof(QueuedRequest))); + req = XtReallocArray(req, (Cardinal) (start + count), + (Cardinal) sizeof(QueuedRequest)); while (i < count) { QueuedRequest newreq = (QueuedRequest) __XtMalloc(sizeof(QueuedRequestRec)); @@ -2075,7 +2071,7 @@ XtCreateSelectionRequest(Widget widget, Atom selection) QueuedRequestInfo queueInfo; Window window = XtWindow(widget); Display *dpy = XtDisplay(widget); - int n; + Cardinal n; LOCK_PROCESS; if (multipleContext == 0) @@ -2102,9 +2098,8 @@ XtCreateSelectionRequest(Widget widget, Atom selection) n = 0; while (queueInfo->selections[n] != None) n++; - queueInfo->selections = - (Atom *) XtRealloc((char *) queueInfo->selections, - (Cardinal) ((size_t) (n + 2) * sizeof(Atom))); + queueInfo->selections = XtReallocArray(queueInfo->selections, (n + 2), + (Cardinal) sizeof(Atom)); queueInfo->selections[n] = selection; queueInfo->selections[n + 1] = None; @@ -2332,9 +2327,8 @@ AddParamInfo(Widget w, Atom selection, Atom param_atom) } if (n == 0) { pinfo->count++; - pinfo->paramlist = (Param) - XtRealloc((char *) pinfo->paramlist, - (Cardinal) (pinfo->count * sizeof(ParamRec))); + pinfo->paramlist = XtReallocArray(pinfo->paramlist, pinfo->count, + (Cardinal) sizeof(ParamRec)); p = &pinfo->paramlist[pinfo->count - 1]; (void) XSaveContext(XtDisplay(w), XtWindow(w), paramPropertyContext, (char *) pinfo); |