[gjs: 12/21] util: Move util/error to gjs/error-types
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs: 12/21] util: Move util/error to gjs/error-types
- Date: Sun, 9 Jun 2019 17:03:10 +0000 (UTC)
commit e9d108c4a67a45bc2caf5429736f164956f6c9dc
Author: Philip Chimento <philip chimento gmail com>
Date: Sat Jun 8 21:59:32 2019 -0700
util: Move util/error to gjs/error-types
This is not really a utility file, it's part of the GJS public API, so
it should go in gjs/ and its header file should be installed in the
normal $pkgincludedir/gjs location; #include <util/error.h> isn't
namespaced and might be provided by any number of libraries.
gi/gerror.cpp | 2 +-
gjs-srcs.mk | 4 ++--
gjs/context.cpp | 2 +-
gjs/coverage.cpp | 2 +-
util/error.cpp => gjs/error-types.cpp | 21 ++++++---------------
util/error.h => gjs/error-types.h | 6 +++---
gjs/gjs.h | 2 +-
gjs/jsapi-util.cpp | 2 +-
test/gjs-tests.cpp | 4 ++--
9 files changed, 18 insertions(+), 27 deletions(-)
---
diff --git a/gi/gerror.cpp b/gi/gerror.cpp
index 366e42aa..7f2b8bfa 100644
--- a/gi/gerror.cpp
+++ b/gi/gerror.cpp
@@ -29,11 +29,11 @@
#include "enumeration.h"
#include "gerror.h"
#include "gjs/context-private.h"
+#include "gjs/error-types.h"
#include "gjs/jsapi-class.h"
#include "gjs/jsapi-wrapper.h"
#include "gjs/mem-private.h"
#include "repo.h"
-#include "util/error.h"
#include <util/log.h>
diff --git a/gjs-srcs.mk b/gjs-srcs.mk
index 2a985330..389c3d02 100644
--- a/gjs-srcs.mk
+++ b/gjs-srcs.mk
@@ -1,11 +1,11 @@
gjs_public_headers = \
gjs/context.h \
gjs/coverage.h \
+ gjs/error-types.h \
gjs/gjs.h \
gjs/macros.h \
gjs/mem.h \
gjs/profiler.h \
- util/error.h \
$(NULL)
# For historical reasons, some files live in gi/
@@ -64,6 +64,7 @@ gjs_srcs = \
gjs/debugger.cpp \
gjs/deprecation.cpp \
gjs/deprecation.h \
+ gjs/error-types.cpp \
gjs/engine.cpp \
gjs/engine.h \
gjs/global.cpp \
@@ -90,7 +91,6 @@ gjs_srcs = \
gjs/stack.cpp \
modules/modules.cpp \
modules/modules.h \
- util/error.cpp \
util/log.cpp \
util/log.h \
util/misc.cpp \
diff --git a/gjs/context.cpp b/gjs/context.cpp
index 41a745dc..8f0dc56c 100644
--- a/gjs/context.cpp
+++ b/gjs/context.cpp
@@ -39,6 +39,7 @@
#include "gi/object.h"
#include "gi/private.h"
#include "gi/repo.h"
+#include "gjs/error-types.h"
#include "global.h"
#include "importer.h"
#include "jsapi-util.h"
@@ -50,7 +51,6 @@
#include <modules/modules.h>
#include <util/log.h>
-#include <util/error.h>
#include "util/misc.h"
#ifdef G_OS_WIN32
diff --git a/gjs/coverage.cpp b/gjs/coverage.cpp
index 13118df7..f02472d5 100644
--- a/gjs/coverage.cpp
+++ b/gjs/coverage.cpp
@@ -30,10 +30,10 @@
#include "coverage.h"
#include "gjs/context-private.h"
+#include "gjs/error-types.h"
#include "global.h"
#include "importer.h"
#include "jsapi-util-args.h"
-#include "util/error.h"
struct _GjsCoverage {
GObject parent;
diff --git a/util/error.cpp b/gjs/error-types.cpp
similarity index 89%
rename from util/error.cpp
rename to gjs/error-types.cpp
index b653b089..0abf7545 100644
--- a/util/error.cpp
+++ b/gjs/error-types.cpp
@@ -25,23 +25,14 @@
#include <glib-object.h>
-#include "error.h"
+#include "gjs/error-types.h"
-GQuark
-gjs_error_quark (void)
-{
- return g_quark_from_static_string ("gjs-error-quark");
-}
-
-GQuark
-gjs_js_error_quark(void)
-{
- return g_quark_from_static_string("gjs-js-error-quark");
-}
+// clang-format off
+G_DEFINE_QUARK(gjs-error-quark, gjs_error)
+G_DEFINE_QUARK(gjs-js-error-quark, gjs_js_error)
+// clang-format on
-GType
-gjs_js_error_get_type(void)
-{
+GType gjs_js_error_get_type(void) {
static volatile GType g_type_id;
if (g_once_init_enter(&g_type_id)) {
diff --git a/util/error.h b/gjs/error-types.h
similarity index 95%
rename from util/error.h
rename to gjs/error-types.h
index 1eba4235..bf7fb9a1 100644
--- a/util/error.h
+++ b/gjs/error-types.h
@@ -21,8 +21,8 @@
* IN THE SOFTWARE.
*/
-#ifndef GJS_UTIL_ERROR_H_
-#define GJS_UTIL_ERROR_H_
+#ifndef GJS_ERROR_TYPES_H_
+#define GJS_ERROR_TYPES_H_
#if !defined(INSIDE_GJS_H) && !defined(GJS_COMPILATION)
# error "Only <gjs/gjs.h> can be included directly."
@@ -65,4 +65,4 @@ typedef enum {
G_END_DECLS
-#endif /* GJS_UTIL_ERROR_H_ */
+#endif /* GJS_ERROR_TYPES_H_ */
diff --git a/gjs/gjs.h b/gjs/gjs.h
index f1535d89..ffd9a418 100644
--- a/gjs/gjs.h
+++ b/gjs/gjs.h
@@ -28,10 +28,10 @@
#include <gjs/context.h>
#include <gjs/coverage.h>
+#include <gjs/error-types.h>
#include <gjs/macros.h>
#include <gjs/mem.h>
#include <gjs/profiler.h>
-#include <util/error.h>
#undef INSIDE_GJS_H
diff --git a/gjs/jsapi-util.cpp b/gjs/jsapi-util.cpp
index 1740d2bb..8257d448 100644
--- a/gjs/jsapi-util.cpp
+++ b/gjs/jsapi-util.cpp
@@ -40,9 +40,9 @@
#endif
#include "gjs/context-private.h"
+#include "gjs/error-types.h"
#include "gjs/jsapi-class.h"
#include "gjs/jsapi-util.h"
-#include "util/error.h"
#include "util/log.h"
#include "util/misc.h"
diff --git a/test/gjs-tests.cpp b/test/gjs-tests.cpp
index 522847a0..3a7f25b3 100644
--- a/test/gjs-tests.cpp
+++ b/test/gjs-tests.cpp
@@ -29,10 +29,10 @@
#include <glib-object.h>
#include <gjs/gjs.h>
+#include "gjs-test-utils.h"
+#include "gjs/error-types.h"
#include "gjs/jsapi-util.h"
#include "gjs/jsapi-wrapper.h"
-#include "gjs-test-utils.h"
-#include "util/error.h"
#include "util/misc.h"
#define VALID_UTF8_STRING "\303\211\303\226 foobar \343\203\237"
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]