From 7d7224d8543e85e3a34a1cddf99f3eac9aa9050b Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Tue, 12 Apr 2011 21:27:45 -0700 Subject: Replace Xmalloc+bzero pairs with Xcalloc calls Signed-off-by: Alan Coopersmith Reviewed-by: Jeremy Huddleston Backported-to-NX-by: Ulrich Sibiller --- nx-X11/lib/X11/imRmAttr.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) (limited to 'nx-X11/lib/X11/imRmAttr.c') diff --git a/nx-X11/lib/X11/imRmAttr.c b/nx-X11/lib/X11/imRmAttr.c index 975a1edcd..56a55a13f 100644 --- a/nx-X11/lib/X11/imRmAttr.c +++ b/nx-X11/lib/X11/imRmAttr.c @@ -1405,7 +1405,6 @@ _XimGetAttributeID( { unsigned int n; XIMResourceList res; - int res_len; char *names; int names_len; XPointer tmp; @@ -1423,18 +1422,15 @@ _XimGetAttributeID( if (!(n = _XimCountNumberOfAttr(buf[0], &buf[1], &names_len))) return False; - res_len = sizeof(XIMResource) * n; - if (!(res = (XIMResourceList)Xmalloc(res_len))) + if (!(res = Xcalloc(n, sizeof(XIMResource)))) return False; - bzero((char *)res, res_len); values_len = sizeof(XIMValuesList) + (sizeof(char **) * n) + names_len; - if (!(tmp = (XPointer)Xmalloc(values_len))) { + if (!(tmp = Xcalloc(1, values_len))) { Xfree(res); return False; } - bzero(tmp, values_len); values_list = (XIMValuesList *)tmp; values = (char **)((char *)tmp + sizeof(XIMValuesList)); @@ -1472,18 +1468,15 @@ _XimGetAttributeID( if (!(n = _XimCountNumberOfAttr(buf[0], &buf[2], &names_len))) return False; - res_len = sizeof(XIMResource) * n; - if (!(res = (XIMResourceList)Xmalloc(res_len))) + if (!(res = Xcalloc(n, sizeof(XIMResource)))) return False; - bzero((char *)res, res_len); values_len = sizeof(XIMValuesList) + (sizeof(char **) * n) + names_len; - if (!(tmp = (XPointer)Xmalloc(values_len))) { + if (!(tmp = Xcalloc(1, values_len))) { Xfree(res); return False; } - bzero(tmp, values_len); values_list = (XIMValuesList *)tmp; values = (char **)((char *)tmp + sizeof(XIMValuesList)); -- cgit v1.2.3