From ccd9aabecdfc3c467d158b4391a505bf79870859 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sigrid=20Solveig=20Hafl=C3=ADnud=C3=B3ttir?= Date: Fri, 17 Sep 2021 20:24:50 +0200 Subject: [PATCH] ppu: remove unused "pixels" field from Ppu; reset bg/fg to all zeroes on init --- src/devices/ppu.c | 4 ++-- src/devices/ppu.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/devices/ppu.c b/src/devices/ppu.c index bff1d6c..9961a5a 100644 --- a/src/devices/ppu.c +++ b/src/devices/ppu.c @@ -76,7 +76,7 @@ ppu_init(Ppu *p, Uint8 hor, Uint8 ver) { p->width = 8 * hor; p->height = 8 * ver; - p->bg = malloc(p->width / 4 * p->height * sizeof(Uint8)); - p->fg = malloc(p->width / 4 * p->height * sizeof(Uint8)); + p->bg = calloc(1, p->width / 4 * p->height * sizeof(Uint8)); + p->fg = calloc(1, p->width / 4 * p->height * sizeof(Uint8)); return 1; } diff --git a/src/devices/ppu.h b/src/devices/ppu.h index 5fb24fe..a055d9e 100644 --- a/src/devices/ppu.h +++ b/src/devices/ppu.h @@ -19,7 +19,7 @@ typedef unsigned int Uint32; typedef struct Ppu { Uint16 width, height; - Uint8 *pixels, *bg, *fg; + Uint8 *bg, *fg; } Ppu; int ppu_init(Ppu *p, Uint8 hor, Uint8 ver);