spice: Initialization stubs on qemu-spice.h

This reduces the number of CONFIG_SPICE #ifdefs in vl.c.

Cc: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
This commit is contained in:
Eduardo Habkost 2016-04-19 16:55:23 -03:00
parent 19a2c6269f
commit 6f0c894c25
2 changed files with 13 additions and 4 deletions

View File

@ -51,6 +51,8 @@ static inline CharDriverState *qemu_chr_open_spice_port(const char *name)
#else /* CONFIG_SPICE */
#include "qemu/error-report.h"
#define using_spice 0
#define spice_displays 0
static inline int qemu_spice_set_passwd(const char *passwd,
@ -75,6 +77,17 @@ static inline int qemu_spice_display_add_client(int csock, int skipauth,
return -1;
}
static inline void qemu_spice_display_init(void)
{
/* This must never be called if CONFIG_SPICE is disabled */
error_report("spice support is disabled");
abort();
}
static inline void qemu_spice_init(void)
{
}
#endif /* CONFIG_SPICE */
static inline bool qemu_using_spice(Error **errp)

4
vl.c
View File

@ -4360,10 +4360,8 @@ int main(int argc, char **argv, char **envp)
os_set_line_buffering();
#ifdef CONFIG_SPICE
/* spice needs the timers to be initialized by this point */
qemu_spice_init();
#endif
cpu_ticks_init();
if (icount_opts) {
@ -4564,11 +4562,9 @@ int main(int argc, char **argv, char **envp)
g_free(ret);
}
#ifdef CONFIG_SPICE
if (using_spice) {
qemu_spice_display_init();
}
#endif
if (foreach_device_config(DEV_GDB, gdbserver_start) < 0) {
exit(1);