From b3886dd89f7a3394eed2c9e574909646b6024197 Mon Sep 17 00:00:00 2001 From: Alexander Myltsev Date: Mon, 24 Nov 2008 09:21:13 +0300 Subject: ps.c: malloc + memset -> calloc --- libspectre/ps.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/libspectre/ps.c b/libspectre/ps.c index a5489be..0980f80 100644 --- a/libspectre/ps.c +++ b/libspectre/ps.c @@ -462,9 +462,8 @@ psscan(const char *filename, int scanstyle) if ((iscomment(line,"%!PS") || iscomment(line, "\004%!PS"))) { INFMESSAGE(found "PS-Adobe-" comment) - doc = (struct document *) PS_malloc(sizeof(struct document)); + doc = (struct document *) PS_calloc(1, sizeof(struct document)); CHECK_MALLOCED(doc); - memset(doc, 0, sizeof(struct document)); /* ignore possible leading ^D */ if (*line == '\004') { @@ -499,9 +498,8 @@ psscan(const char *filename, int scanstyle) In a way, this makes sense, a program PostScript does not need the !PS at the beginning. */ - doc = (struct document *) PS_malloc(sizeof(struct document)); + doc = (struct document *) PS_calloc(1, sizeof(struct document)); CHECK_MALLOCED(doc); - memset(doc, 0, sizeof(struct document)); doc->ref_count = 1; doc->filename = _spectre_strdup (filename); doc->default_page_orientation = NONE; -- cgit v1.2.3