summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2022-08-06 11:44:08 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2022-08-06 11:44:41 -0700
commit24c71e04d248f06337f7885dc5642d720a087ba9 (patch)
tree17956abc6214b6c6fa018cb0861b678268ad135f
parent52b7307f42f99c81eda97a322dc3ffccd9e371f6 (diff)
No need to bzero() buffers allocated by calloc()
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r--x2pmp.c4
-rw-r--r--xpr.c3
2 files changed, 2 insertions, 5 deletions
diff --git a/x2pmp.c b/x2pmp.c
index 81c51e9..fc584aa 100644
--- a/x2pmp.c
+++ b/x2pmp.c
@@ -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;
diff --git a/xpr.c b/xpr.c
index 4c4e3b5..ccf064c 100644
--- a/xpr.c
+++ b/xpr.c
@@ -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++) {