summaryrefslogtreecommitdiff
path: root/src/Selection.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/Selection.c')
-rw-r--r--src/Selection.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/src/Selection.c b/src/Selection.c
index 618d73b..1821cb4 100644
--- a/src/Selection.c
+++ b/src/Selection.c
@@ -286,13 +286,12 @@ MakeInfo(Select ctx,
CallBackInfo info = XtNew(CallBackInfoRec);
info->ctx = ctx;
- info->callbacks = (XtSelectionCallbackProc *)
- __XtMalloc((unsigned)
- ((size_t) count * sizeof(XtSelectionCallbackProc)));
+ info->callbacks = XtMallocArray((Cardinal) count,
+ (Cardinal) sizeof(XtSelectionCallbackProc));
(void) memcpy(info->callbacks, callbacks,
(size_t) count * sizeof(XtSelectionCallbackProc));
- info->req_closure = (XtPointer *)
- __XtMalloc((unsigned) ((size_t) count * sizeof(XtPointer)));
+ info->req_closure = XtMallocArray((Cardinal) count,
+ (Cardinal) sizeof(XtPointer));
(void) memcpy(info->req_closure, closures,
(size_t) count * sizeof(XtPointer));
if (count == 1 && properties != NULL && properties[0] != None)
@@ -304,8 +303,8 @@ MakeInfo(Select ctx,
info->proc = HandleSelectionReplies;
info->widget = widget;
info->time = time;
- info->incremental =
- (Boolean *) __XtMalloc((Cardinal) ((size_t) count * sizeof(Boolean)));
+ info->incremental = XtMallocArray((Cardinal) count,
+ (Cardinal) sizeof(Boolean));
(void) memcpy(info->incremental, incremental,
(size_t) count * sizeof(Boolean));
info->current = 0;
@@ -1751,13 +1750,13 @@ GetSelectionValues(Widget widget,
time, incremental, properties);
XtStackFree((XtPointer) passed_callbacks, stack_cbs);
- info->target = (Atom *)
- __XtMalloc((unsigned) ((size_t) (count + 1) * sizeof(Atom)));
+ info->target = XtMallocArray ((Cardinal) count + 1,
+ (Cardinal) sizeof(Atom));
(*info->target) = ctx->prop_list->indirect_atom;
(void) memcpy((char *) info->target + sizeof(Atom), targets,
(size_t) count * sizeof(Atom));
- pairs = (IndirectPair *)
- __XtMalloc((unsigned) ((size_t) count * sizeof(IndirectPair)));
+ pairs = XtMallocArray ((Cardinal) count + 1,
+ (Cardinal) sizeof(IndirectPair));
for (p = &pairs[count - 1], t = &targets[count - 1], i = count - 1;
p >= pairs; p--, t--, i--) {
p->target = *t;
@@ -2088,7 +2087,7 @@ XtCreateSelectionRequest(Widget widget, Atom selection)
queueInfo =
(QueuedRequestInfo) __XtMalloc(sizeof(QueuedRequestInfoRec));
queueInfo->count = 0;
- queueInfo->selections = (Atom *) __XtMalloc(sizeof(Atom) * 2);
+ queueInfo->selections = XtMallocArray(2, (Cardinal) sizeof(Atom));
queueInfo->selections[0] = None;
queueInfo->requests = (QueuedRequest *)
__XtMalloc(sizeof(QueuedRequest));