diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2022-08-06 11:44:08 -0700 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2022-08-06 11:44:41 -0700 |
commit | 24c71e04d248f06337f7885dc5642d720a087ba9 (patch) | |
tree | 17956abc6214b6c6fa018cb0861b678268ad135f | |
parent | 52b7307f42f99c81eda97a322dc3ffccd9e371f6 (diff) |
No need to bzero() buffers allocated by calloc()
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r-- | x2pmp.c | 4 | ||||
-rw-r--r-- | xpr.c | 3 |
2 files changed, 2 insertions, 5 deletions
@@ -132,7 +132,6 @@ void x2pmp(FILE *in, FILE *out, if ((buffer = calloc(buffer_size, 1)) == NULL) leave("Can't calloc data buffer."); - bzero((char *) buffer, (int) buffer_size); /* Read bitmap from file */ if (fread((char *) buffer, sizeof(char), (int) buffer_size, in) @@ -245,9 +244,8 @@ unsigned char *magnification_table(int scale) unsigned char *tbl; int c; - if ((tbl = calloc((unsigned) (scale*256), sizeof(char))) == NULL) + if ((tbl = calloc(scale, 256)) == NULL) leave("Can't calloc magnification table."); - bzero((char *) tbl, scale*256); for(c = 256; c--;) { int b = c, bit; unsigned char *entry = tbl+c*scale; @@ -1230,12 +1230,11 @@ void ps_output_bits( * Owidth and Oheight are rounded up to a multiple of 32 bits, * to avoid special cases at the boundaries */ - obuf = malloc((unsigned)(owidth*oheight)); + obuf = calloc(owidth, oheight); if (obuf==NULL) { fprintf(stderr,"xpr: cannot allocate %d bytes\n",owidth*oheight); exit(1); } - bzero(obuf,owidth*oheight); ibuf = malloc((unsigned)(iwb + 3)); for (i=0;i<ih;i++) { |