console: two little bugfixes.

-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.22 (GNU/Linux)
 
 iQIcBAABAgAGBQJTluVzAAoJEEy22O7T6HE4MeoP/iZaSBWUpSfku0opAEmJAEso
 fiO+yFEwMNWCGhUVwQTOo5p7JqmOzGoBKNjy4WFtMY3tA1FZGPnh5WH/0pVUQu5C
 X3n4X4wI4xcY9jSPGtan9T5MlZZ92Zmi6NuSxdVxMTtn+DI9GGki8Jo23Fveezo5
 gAhkApy2T8eYK3jdXgzQHawMLw+V2/E/FU5Xxd6+v1EzQooLgODc3QkB25+OFl6n
 5TBo8Rmyfyi70mi2PDX++S3zGr5aRfDLKcfRX+3ZM2NRBGmRJkhinBuaaHrT/d4Q
 dWlKe3da89SbfEbFgd4jeaXXJBVQPXJXT1uj+S4W1DMDwTFCwBj8y+WTHhJD85iF
 N1YyvuI9TEzfvSf3Pq91KXyZ/RGfCfE/4VsNd/dohB8mXmIEZCJVIrBwnOKeyCSa
 viaalNDIRTrwiBvegxAQ95Zweh1KWcOa9qa8UwwG3jzp79iEBzxb+MXWV2QVnyuY
 AK3jWP8Jfyfh8xeG/MW3Wy753IACTREckDe4UGb/bSk8upoiWoH4ZAfqRF8PlLTt
 +YFhGudTxnLsXTvu5SYmGNcIDIQ1fMBT9d+Tm+Qxy4w9m9dqpJT7UvIxiPP//dUW
 1RDM4HjNNutY5JYGbxvgblXTkQeiLOCtw/VFjXVjGV87Ev89Dw6Xa0doX4PEw5I0
 cPaJXKWj7hMws/xgXZTG
 =MgVB
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/kraxel/tags/pull-console-20140610-1' into staging

console: two little bugfixes.

# gpg: Signature made Tue 10 Jun 2014 12:01:07 BST using RSA key ID D3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>"
# gpg:                 aka "Gerd Hoffmann <gerd@kraxel.org>"
# gpg:                 aka "Gerd Hoffmann (private) <kraxel@gmail.com>"

* remotes/kraxel/tags/pull-console-20140610-1:
  console: fix -vga none -sdl crash
  console: kill MAX_CONSOLES, alloc consoles dynamically

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell 2014-06-10 12:06:17 +01:00
commit 3334e929ae
1 changed files with 5 additions and 13 deletions

View File

@ -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) {
@ -1191,9 +1187,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;
@ -1211,6 +1204,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;
@ -1585,10 +1580,7 @@ DisplayState *init_displaystate(void)
gchar *name;
int i;
if (!display_state) {
display_state = g_new0(DisplayState, 1);
}
get_alloc_displaystate();
for (i = 0; i < nb_consoles; i++) {
if (consoles[i]->console_type != GRAPHIC_CONSOLE &&
consoles[i]->ds == NULL) {
@ -1634,7 +1626,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];