diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2023-03-03 17:42:47 -0800 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2023-03-07 00:06:24 +0000 |
commit | b3b0c1ad25a5d0f628eddd00113a40364d68480b (patch) | |
tree | 7b1088ab3cc984dd606df1b56fdda7dec975432f /src/Resources.c | |
parent | b1b54c50d0e5851d72c1e7aff4057687be2e447e (diff) | |
download | xorg-lib-libXt-b3b0c1ad25a5d0f628eddd00113a40364d68480b.tar.gz |
Replace XtMalloc() calls with XtMallocArray()
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Diffstat (limited to 'src/Resources.c')
-rw-r--r-- | src/Resources.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/src/Resources.c b/src/Resources.c index 274f9d7..cb60ab2 100644 --- a/src/Resources.c +++ b/src/Resources.c @@ -374,8 +374,7 @@ _XtDependencies(XtResourceList *class_resp, /* VAR */ /* Allocate and initialize new_res with superclass resource pointers */ new_num_res = super_num_res + class_num_res; - new_res = (XrmResourceList *) - __XtMalloc((Cardinal) (new_num_res * sizeof(XrmResourceList))); + new_res = XtMallocArray(new_num_res, (Cardinal) sizeof(XrmResourceList)); if (super_num_res > 0) memcpy(new_res, super_res, super_num_res * sizeof(XrmResourceList)); @@ -461,8 +460,7 @@ _XtCreateIndirectionTable(XtResourceList resources, Cardinal num_resources) register Cardinal idx; XrmResourceList *table; - table = (XrmResourceList *) - __XtMalloc((Cardinal) (num_resources * sizeof(XrmResourceList))); + table = XtMallocArray(num_resources, (Cardinal) sizeof(XrmResourceList)); for (idx = 0; idx < num_resources; idx++) table[idx] = (XrmResourceList) (&(resources[idx])); return table; @@ -920,9 +918,8 @@ GetResources(Widget widget, /* Widget resources are associated with cache_ptr = cache_base; if (cache_ptr && cache_ptr != cache_ref) { int cache_ref_size = (int) (cache_ptr - cache_ref); - XtCacheRef *refs = (XtCacheRef *) - __XtMalloc((Cardinal) - (sizeof(XtCacheRef) * (size_t) (cache_ref_size + 1))); + XtCacheRef *refs = XtMallocArray((Cardinal) cache_ref_size + 1, + (Cardinal) sizeof(XtCacheRef)); (void) memcpy(refs, cache_ref, sizeof(XtCacheRef) * (size_t) cache_ref_size); @@ -948,8 +945,7 @@ CacheArgs(ArgList args, count = (args != NULL) ? num_args : num_typed_args; if (num_quarks < count) { - quarks = - (XrmQuarkList) __XtMalloc((Cardinal) (count * sizeof(XrmQuark))); + quarks = XtMallocArray(count, (Cardinal) sizeof(XrmQuark)); } else { quarks = quark_cache; |