Simplify softmmu/main.c

Move qemu_main() declaration to a new header.

Simplify main.c since both cocoa & sdl cannot be enabled together.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Akihiko Odaki <akihiko.odaki@gmail.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Message-Id: <20220420132624.2439741-5-marcandre.lureau@redhat.com>
This commit is contained in:
Marc-André Lureau 2022-04-20 17:25:47 +04:00
parent 6712f04ec8
commit 88c39c8693
4 changed files with 20 additions and 21 deletions

View File

@ -10,9 +10,4 @@
"See <https://qemu.org/contribute/report-a-bug> for how to report bugs.\n" \
"More information on the QEMU project at <https://qemu.org>."
/* main function, renamed */
#if defined(CONFIG_COCOA)
int qemu_main(int argc, char **argv, char **envp);
#endif
#endif

10
include/qemu-main.h Normal file
View File

@ -0,0 +1,10 @@
/*
* This work is licensed under the terms of the GNU GPL, version 2 or later.
* See the COPYING file in the top-level directory.
*/
#ifndef QEMU_MAIN_H
#define QEMU_MAIN_H
int qemu_main(int argc, char **argv, char **envp);
#endif /* QEMU_MAIN_H */

View File

@ -23,28 +23,14 @@
*/
#include "qemu/osdep.h"
#include "qemu-common.h"
#include "qemu-main.h"
#include "sysemu/sysemu.h"
#ifdef CONFIG_SDL
#if defined(__APPLE__) || defined(main)
#include <SDL.h>
static int qemu_main(int argc, char **argv, char **envp);
int main(int argc, char **argv)
{
return qemu_main(argc, argv, NULL);
}
#undef main
#define main qemu_main
#endif
#endif /* CONFIG_SDL */
#ifdef CONFIG_COCOA
#undef main
#define main qemu_main
#endif /* CONFIG_COCOA */
int main(int argc, char **argv, char **envp)
int qemu_main(int argc, char **argv, char **envp)
{
qemu_init(argc, argv, envp);
qemu_main_loop();
@ -52,3 +38,10 @@ int main(int argc, char **argv, char **envp)
return 0;
}
#ifndef CONFIG_COCOA
int main(int argc, char **argv)
{
return qemu_main(argc, argv, NULL);
}
#endif

View File

@ -28,6 +28,7 @@
#include <crt_externs.h>
#include "qemu-common.h"
#include "qemu-main.h"
#include "ui/clipboard.h"
#include "ui/console.h"
#include "ui/input.h"