[retro-gtk] environment: Give it a private C header file



commit 3daffeff2c19bc72281cb30da4a0da14ac5df236
Author: Adrien Plazas <kekun plazas laposte net>
Date:   Sat Jul 31 09:22:30 2021 +0200

    environment: Give it a private C header file
    
    This avoids declaring function prototypes in different C files. This
    also helps knowing where some core functions are defined.

 retro-runner/retro-core.c                |  5 +----
 retro-runner/retro-environment-private.h | 16 ++++++++++++++++
 retro-runner/retro-environment.c         |  5 ++---
 3 files changed, 19 insertions(+), 7 deletions(-)
---
diff --git a/retro-runner/retro-core.c b/retro-runner/retro-core.c
index 52f8012..4e048ae 100644
--- a/retro-runner/retro-core.c
+++ b/retro-runner/retro-core.c
@@ -5,6 +5,7 @@
 #include <gio/gio.h>
 #include <string.h>
 #include "retro-error-private.h"
+#include "retro-environment-private.h"
 #include "retro-input-private.h"
 #include "retro-main-loop-source-private.h"
 #include "retro-memfd-private.h"
@@ -75,8 +76,6 @@ retro_core_get_instance (void)
   return retro_core_instance;
 }
 
-void retro_core_set_callbacks (RetroCore *self);
-
 static void
 retro_core_constructed (GObject *object)
 {
@@ -954,8 +953,6 @@ load_medias (RetroCore  *self,
     }, catch, error);
 }
 
-void retro_core_set_environment_interface (RetroCore *self);
-
 /* FIXME: this is partially copied from retro_option_new() */
 static gchar *
 get_default_value (const gchar *description)
diff --git a/retro-runner/retro-environment-private.h b/retro-runner/retro-environment-private.h
new file mode 100644
index 0000000..bea6868
--- /dev/null
+++ b/retro-runner/retro-environment-private.h
@@ -0,0 +1,16 @@
+// 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 "retro-core.h"
+
+G_BEGIN_DECLS
+
+void retro_core_set_callbacks (RetroCore *self);
+void retro_core_set_environment_interface (RetroCore *self);
+
+G_END_DECLS
diff --git a/retro-runner/retro-environment.c b/retro-runner/retro-environment.c
index 29e18f9..a2bba0d 100644
--- a/retro-runner/retro-environment.c
+++ b/retro-runner/retro-environment.c
@@ -1,8 +1,9 @@
 // This file is part of retro-gtk. License: GPL-3.0+.
 
-#include "retro-core-private.h"
+#include "retro-environment-private.h"
 
 #include <stdbool.h>
+#include "retro-core-private.h"
 #include "retro-debug-private.h"
 #include "retro-input-private.h"
 #include "retro-gl-renderer-private.h"
@@ -954,7 +955,6 @@ input_state_cb (guint port,
   return retro_core_get_controller_input_state (self, port, &input);
 }
 
-// TODO This is internal, make it private as soon as possible.
 void
 retro_core_set_environment_interface (RetroCore *self)
 {
@@ -966,7 +966,6 @@ retro_core_set_environment_interface (RetroCore *self)
   set_environment (environment_interface_cb);
 }
 
-// TODO This is internal, make it private as soon as possible.
 void
 retro_core_set_callbacks (RetroCore *self)
 {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]