diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2015-06-04 20:51:17 -0700 |
---|---|---|
committer | Ulrich Sibiller <uli42@gmx.de> | 2016-10-19 21:40:29 +0200 |
commit | 39dd37d57b7bab3e44304562d1bbf9722bf3e03e (patch) | |
tree | 138adc51b876dda86ce0a4498efa187eaa1bbb63 /nx-X11/lib/X11/omGeneric.c | |
parent | a402ed0162562b43a945d9a90b406c54c87c72b6 (diff) | |
download | nx-libs-39dd37d57b7bab3e44304562d1bbf9722bf3e03e.tar.gz nx-libs-39dd37d57b7bab3e44304562d1bbf9722bf3e03e.tar.bz2 nx-libs-39dd37d57b7bab3e44304562d1bbf9722bf3e03e.zip |
Replace Xmalloc+memset pairs with Xcalloc calls
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Backported-to-NX-by: Ulrich Sibiller <uli42@gmx.de>
Diffstat (limited to 'nx-X11/lib/X11/omGeneric.c')
-rw-r--r-- | nx-X11/lib/X11/omGeneric.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/nx-X11/lib/X11/omGeneric.c b/nx-X11/lib/X11/omGeneric.c index c790bbc44..143ec00eb 100644 --- a/nx-X11/lib/X11/omGeneric.c +++ b/nx-X11/lib/X11/omGeneric.c @@ -101,11 +101,10 @@ init_fontdata( FontData fd; int i; - fd = Xmalloc(sizeof(FontDataRec) * font_data_count); + fd = Xcalloc(font_data_count, sizeof(FontDataRec)); if(fd == (FontData) NULL) return False; - memset(fd, 0x00, sizeof(FontDataRec) * font_data_count); for(i = 0 ; i < font_data_count ; i++) fd[i] = font_data[i]; @@ -126,11 +125,10 @@ init_vrotate( if(type == VROTATE_NONE) return (VRotate)NULL; - vrotate = Xmalloc(sizeof(VRotateRec) * font_data_count); + vrotate = Xcalloc(font_data_count, sizeof(VRotateRec)); if(vrotate == (VRotate) NULL) return False; - memset(vrotate, 0x00, sizeof(VRotateRec) * font_data_count); for(i = 0 ; i < font_data_count ; i++) { vrotate[i].charset_name = font_data[i].name; vrotate[i].side = font_data[i].side; @@ -155,10 +153,9 @@ init_fontset( count = XOM_GENERIC(oc->core.om)->data_num; data = XOM_GENERIC(oc->core.om)->data; - font_set = Xmalloc(sizeof(FontSetRec) * count); + font_set = Xcalloc(count, sizeof(FontSetRec)); if (font_set == NULL) return False; - memset((char *) font_set, 0x00, sizeof(FontSetRec) * count); gen = XOC_GENERIC(oc); gen->font_set_num = count; @@ -1094,11 +1091,10 @@ parse_vw( Xfree(vrotate); if(sub_num > 0) { - vrotate = font_set->vrotate = Xmalloc - (sizeof(VRotateRec) * sub_num); + vrotate = font_set->vrotate = Xcalloc(sub_num, + sizeof(VRotateRec)); if(font_set->vrotate == (VRotate)NULL) return (-1); - memset(font_set->vrotate, 0x00, sizeof(VRotateRec) * sub_num); for(i = 0 ; i < sub_num ; i++) { vrotate[i].charset_name = font_set->substitute[i].name; |