* [Qemu-devel] [PATCH] console: kill MAX_CONSOLES, alloc consoles dynamically
@ 2014-05-26 9:26 Gerd Hoffmann
0 siblings, 0 replies; only message in thread
From: Gerd Hoffmann @ 2014-05-26 9:26 UTC (permalink / raw)
To: qemu-devel; +Cc: Gerd Hoffmann, Anthony Liguori
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
ui/console.c | 13 ++++---------
1 file changed, 4 insertions(+), 9 deletions(-)
diff --git a/ui/console.c b/ui/console.c
index 75ec3af..3bc18cf 100644
--- a/ui/console.c
+++ b/ui/console.c
@@ -30,7 +30,6 @@
#include "trace.h"
#define DEFAULT_BACKSCROLL 512
-#define MAX_CONSOLES 12
#define CONSOLE_CURSOR_PERIOD 500
typedef struct TextAttributes {
@@ -173,7 +172,7 @@ struct DisplayState {
static DisplayState *display_state;
static QemuConsole *active_console;
-static QemuConsole *consoles[MAX_CONSOLES];
+static QemuConsole **consoles;
static int nb_consoles = 0;
static bool cursor_visible_phase;
static QEMUTimer *cursor_timer;
@@ -983,9 +982,6 @@ void console_select(unsigned int index)
DisplayChangeListener *dcl;
QemuConsole *s;
- if (index >= MAX_CONSOLES)
- return;
-
trace_console_select(index);
s = qemu_console_lookup_by_index(index);
if (s) {
@@ -1158,9 +1154,6 @@ static QemuConsole *new_console(DisplayState *ds, console_type_t console_type,
QemuConsole *s;
int i;
- if (nb_consoles >= MAX_CONSOLES)
- return NULL;
-
obj = object_new(TYPE_QEMU_CONSOLE);
s = QEMU_CONSOLE(obj);
s->head = head;
@@ -1178,6 +1171,8 @@ static QemuConsole *new_console(DisplayState *ds, console_type_t console_type,
}
s->ds = ds;
s->console_type = console_type;
+
+ consoles = g_realloc(consoles, sizeof(*consoles) * (nb_consoles+1));
if (console_type != GRAPHIC_CONSOLE) {
s->index = nb_consoles;
consoles[nb_consoles++] = s;
@@ -1601,7 +1596,7 @@ QemuConsole *graphic_console_init(DeviceState *dev, uint32_t head,
QemuConsole *qemu_console_lookup_by_index(unsigned int index)
{
- if (index >= MAX_CONSOLES) {
+ if (index >= nb_consoles) {
return NULL;
}
return consoles[index];
--
1.8.3.1
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2014-05-26 9:26 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-26 9:26 [Qemu-devel] [PATCH] console: kill MAX_CONSOLES, alloc consoles dynamically Gerd Hoffmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).