[retro-gtk] core: Factorize error types
- From: Adrien Plazas <aplazas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [retro-gtk] core: Factorize error types
- Date: Sun, 1 Aug 2021 06:43:58 +0000 (UTC)
commit 2d5e80b9815cdc8eb026299a88723e0b729f2187
Author: Adrien Plazas <kekun plazas laposte net>
Date: Sun Aug 1 09:59:25 2021 +0200
core: Factorize error types
We don't want to duplicate them.
retro-gtk/retro-core.c | 16 +---------------
retro-runner/retro-core.c | 14 +-------------
shared/retro-core-error-private.h | 26 ++++++++++++++++++++++++++
3 files changed, 28 insertions(+), 28 deletions(-)
---
diff --git a/retro-gtk/retro-core.c b/retro-gtk/retro-core.c
index ce8e6c3..3f50fce 100644
--- a/retro-gtk/retro-core.c
+++ b/retro-gtk/retro-core.c
@@ -17,6 +17,7 @@
#include "retro-controller-iterator-private.h"
#include "retro-controller-state-private.h"
#include "retro-controller-type.h"
+#include "retro-core-error-private.h"
#include "retro-error-private.h"
#include "retro-framebuffer-private.h"
#include "retro-input-private.h"
@@ -30,21 +31,6 @@
#define RETRO_CONTROLLER_TYPE_COUNT (RETRO_CONTROLLER_TYPE_POINTER + 1)
-#define RETRO_CORE_ERROR (retro_core_error_quark ())
-
-enum {
- RETRO_CORE_ERROR_COULDNT_ACCESS_FILE,
- RETRO_CORE_ERROR_COULDNT_SERIALIZE,
- RETRO_CORE_ERROR_COULDNT_DESERIALIZE,
- RETRO_CORE_ERROR_SERIALIZATION_NOT_SUPPORTED,
- RETRO_CORE_ERROR_NO_CALLBACK,
- RETRO_CORE_ERROR_NO_MEMORY_REGION,
- RETRO_CORE_ERROR_UNEXPECTED_MEMORY_REGION,
- RETRO_CORE_ERROR_SIZE_MISMATCH,
-};
-
-G_DEFINE_QUARK (retro-core-error, retro_core_error)
-
typedef struct {
RetroController *controller;
guint port;
diff --git a/retro-runner/retro-core.c b/retro-runner/retro-core.c
index db32741..3d3f563 100644
--- a/retro-runner/retro-core.c
+++ b/retro-runner/retro-core.c
@@ -4,6 +4,7 @@
#include <gio/gio.h>
#include <string.h>
+#include "retro-core-error-private.h"
#include "retro-error-private.h"
#include "retro-environment-private.h"
#include "retro-input-private.h"
@@ -11,19 +12,6 @@
#include "retro-memfd-private.h"
#include "retro-rumble-effect.h"
-#define RETRO_CORE_ERROR (retro_core_error_quark ())
-
-enum {
- RETRO_CORE_ERROR_COULDNT_ACCESS_FILE,
- RETRO_CORE_ERROR_COULDNT_SERIALIZE,
- RETRO_CORE_ERROR_COULDNT_DESERIALIZE,
- RETRO_CORE_ERROR_SERIALIZATION_NOT_SUPPORTED,
- RETRO_CORE_ERROR_NO_CALLBACK,
- RETRO_CORE_ERROR_NO_MEMORY_REGION,
- RETRO_CORE_ERROR_UNEXPECTED_MEMORY_REGION,
- RETRO_CORE_ERROR_SIZE_MISMATCH,
-};
-
G_DEFINE_QUARK (retro-core-error, retro_core_error)
G_DEFINE_TYPE (RetroCore, retro_core, G_TYPE_OBJECT)
diff --git a/shared/retro-core-error-private.h b/shared/retro-core-error-private.h
new file mode 100644
index 0000000..7fc8674
--- /dev/null
+++ b/shared/retro-core-error-private.h
@@ -0,0 +1,26 @@
+// This file is part of retro-gtk. License: GPL-3.0+.
+
+#pragma once
+
+#if !defined(__RETRO_GTK_INSIDE__) && !defined(RETRO_GTK_COMPILATION)
+# error "Only <retro-gtk.h> can be included directly."
+#endif
+
+#include <glib.h>
+
+G_BEGIN_DECLS
+
+#define RETRO_CORE_ERROR (retro_core_error_quark ())
+
+enum {
+ RETRO_CORE_ERROR_COULDNT_ACCESS_FILE,
+ RETRO_CORE_ERROR_COULDNT_SERIALIZE,
+ RETRO_CORE_ERROR_COULDNT_DESERIALIZE,
+ RETRO_CORE_ERROR_SERIALIZATION_NOT_SUPPORTED,
+ RETRO_CORE_ERROR_NO_CALLBACK,
+ RETRO_CORE_ERROR_NO_MEMORY_REGION,
+ RETRO_CORE_ERROR_UNEXPECTED_MEMORY_REGION,
+ RETRO_CORE_ERROR_SIZE_MISMATCH,
+};
+
+G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]