[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 6/6] ui/curses: Move arrays to .heap to save 74KiB of .bss
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH 6/6] ui/curses: Move arrays to .heap to save 74KiB of .bss |
Date: |
Wed, 4 Mar 2020 23:18:07 +0100 |
We only need these arrays when using the curses display.
Move them from the .bss to the .heap (sizes reported on
x86_64 host: screen[] is 64KiB, vga_to_curses 7KiB).
Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
---
ui/curses.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/ui/curses.c b/ui/curses.c
index 3bafc10c1c..a59b23a9cf 100644
--- a/ui/curses.c
+++ b/ui/curses.c
@@ -54,13 +54,13 @@ enum maybe_keycode {
};
static DisplayChangeListener *dcl;
-static console_ch_t screen[160 * 100];
+static console_ch_t *screen;
static WINDOW *screenpad = NULL;
static int width, height, gwidth, gheight, invalidate;
static int px, py, sminx, sminy, smaxx, smaxy;
static const char *font_charset = "CP437";
-static cchar_t vga_to_curses[256];
+static cchar_t *vga_to_curses;
static void curses_update(DisplayChangeListener *dcl,
int x, int y, int w, int h)
@@ -405,6 +405,8 @@ static void curses_refresh(DisplayChangeListener *dcl)
static void curses_atexit(void)
{
endwin();
+ g_free(vga_to_curses);
+ g_free(screen);
}
/*
@@ -783,6 +785,8 @@ static void curses_display_init(DisplayState *ds,
DisplayOptions *opts)
if (opts->u.curses.charset) {
font_charset = opts->u.curses.charset;
}
+ screen = g_new0(console_ch_t, 160 * 100);
+ vga_to_curses = g_new0(cchar_t, 256);
curses_setup();
curses_keyboard_setup();
atexit(curses_atexit);
--
2.21.1
- Re: [PATCH 1/6] hw/audio/fmopl: Fix a typo twice, (continued)
[PATCH 2/6] hw/audio/fmopl: Move ENV_CURVE to .heap to save 32KiB of .bss, Philippe Mathieu-Daudé, 2020/03/04
[PATCH 5/6] ui/curses: Make control_characters[] array const, Philippe Mathieu-Daudé, 2020/03/04
[PATCH 4/6] hw/audio/intel-hda: Use memory region alias to reduce .rodata by 4.34MB, Philippe Mathieu-Daudé, 2020/03/04
[PATCH 6/6] ui/curses: Move arrays to .heap to save 74KiB of .bss,
Philippe Mathieu-Daudé <=