[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 03/30] Simplify softmmu/main.c
From: |
marcandre . lureau |
Subject: |
[PULL 03/30] Simplify softmmu/main.c |
Date: |
Thu, 21 Apr 2022 17:49:13 +0400 |
From: Marc-André Lureau <marcandre.lureau@redhat.com>
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>
---
include/qemu-common.h | 5 -----
include/qemu-main.h | 10 ++++++++++
softmmu/main.c | 25 +++++++++----------------
ui/cocoa.m | 1 +
4 files changed, 20 insertions(+), 21 deletions(-)
create mode 100644 include/qemu-main.h
diff --git a/include/qemu-common.h b/include/qemu-common.h
index a923ed28d5bf..ba32cc8b1f39 100644
--- a/include/qemu-common.h
+++ b/include/qemu-common.h
@@ -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
diff --git a/include/qemu-main.h b/include/qemu-main.h
new file mode 100644
index 000000000000..6a3e90d0ad59
--- /dev/null
+++ b/include/qemu-main.h
@@ -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 */
diff --git a/softmmu/main.c b/softmmu/main.c
index 639c67ff4893..c00432ff098e 100644
--- a/softmmu/main.c
+++ b/softmmu/main.c
@@ -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
diff --git a/ui/cocoa.m b/ui/cocoa.m
index c4e5468f9e64..839ae4f58a69 100644
--- a/ui/cocoa.m
+++ b/ui/cocoa.m
@@ -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"
--
2.36.0
- [PULL 00/30] Misc patches, marcandre . lureau, 2022/04/21
- [PULL 01/30] glib-compat: isolate g_date_time_format_iso8601 version-bypass, marcandre . lureau, 2022/04/21
- [PULL 02/30] scripts/analyze-inclusions: drop qemu-common.h from analysis, marcandre . lureau, 2022/04/21
- [PULL 03/30] Simplify softmmu/main.c,
marcandre . lureau <=
- [PULL 05/30] include: rename qemu-common.h qemu/help-texts.h, marcandre . lureau, 2022/04/21
- [PULL 04/30] hw/hyperv: remove needless qemu-common.h include, marcandre . lureau, 2022/04/21
- [PULL 06/30] qga: replace usleep() with g_usleep(), marcandre . lureau, 2022/04/21
- [PULL 08/30] arm/digic: replace snprintf() with g_strdup_printf(), marcandre . lureau, 2022/04/21
- [PULL 07/30] docs: trace-events-all is installed without renaming, marcandre . lureau, 2022/04/21
- [PULL 09/30] arm/allwinner-a10: replace snprintf() with g_strdup_printf(), marcandre . lureau, 2022/04/21
- [PULL 10/30] intc/exynos4210_gic: replace snprintf() with g_strdup_printf(), marcandre . lureau, 2022/04/21
- [PULL 11/30] doc/style: CLang -> Clang, marcandre . lureau, 2022/04/21
- [PULL 12/30] osdep.h: move qemu_build_not_reached(), marcandre . lureau, 2022/04/21
- [PULL 13/30] compiler.h: replace QEMU_NORETURN with G_NORETURN, marcandre . lureau, 2022/04/21