[gjs: 2/5] function: Move Function into the Gjs namespace to be unique
- From: Philip Chimento <pchimento src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs: 2/5] function: Move Function into the Gjs namespace to be unique
- Date: Fri, 14 May 2021 04:11:05 +0000 (UTC)
commit d87e961861cc6ec934c300bca7f9528bd21aba61
Author: Marco Trevisan (TreviƱo) <mail 3v1n0 net>
Date: Thu May 6 22:01:29 2021 +0200
function: Move Function into the Gjs namespace to be unique
There's a such definition in readline and this breaks building both with
pch and with unity builds
gi/function.cpp | 19 ++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)
---
diff --git a/gi/function.cpp b/gi/function.cpp
index 44864c00..aa272471 100644
--- a/gi/function.cpp
+++ b/gi/function.cpp
@@ -54,6 +54,8 @@
*/
#define GJS_ARG_INDEX_INVALID G_MAXUINT8
+namespace Gjs {
+
class Function : public CWrapper<Function> {
friend CWrapperPointerOps<Function>;
friend CWrapper<Function>;
@@ -170,6 +172,8 @@ class Function : public CWrapper<Function> {
}
};
+} // namespace Gjs
+
/* Because we can't free the mmap'd data for a callback
* while it's in use, this list keeps track of ones that
* will be freed the next time we invoke a C function.
@@ -737,7 +741,7 @@ bool GjsCallbackTrampoline::initialize(JSContext* cx,
}
// Intended for error messages
-std::string Function::format_name() {
+std::string Gjs::Function::format_name() {
bool is_method = g_callable_info_is_method(m_info);
std::string retval = is_method ? "method" : "function";
retval += ' ';
@@ -753,6 +757,8 @@ std::string Function::format_name() {
void gjs_function_clear_async_closures() { completed_trampolines.clear(); }
+namespace Gjs {
+
static void* get_return_ffi_pointer_from_giargument(
GjsArgumentCache* return_arg, GIFFIReturnValue* return_value) {
// This should be the inverse of gi_type_info_extract_ffi_return_value().
@@ -1092,7 +1098,7 @@ bool Function::call(JSContext* context, unsigned js_argc, JS::Value* vp) {
JS::CallArgs js_argv = JS::CallArgsFromVp(js_argc, vp);
JS::RootedObject callee(context, &js_argv.callee());
- Function *priv;
+ Function* priv;
if (!Function::for_js_typecheck(context, callee, &priv, &js_argv))
return false;
@@ -1320,6 +1326,8 @@ JSObject* Function::create(JSContext* context, GType gtype,
return function;
}
+} // namespace Gjs
+
GJS_JSAPI_RETURN_CONVENTION
JSObject*
gjs_define_function(JSContext *context,
@@ -1333,7 +1341,8 @@ gjs_define_function(JSContext *context,
info_type = g_base_info_get_type((GIBaseInfo *)info);
- JS::RootedObject function(context, Function::create(context, gtype, info));
+ JS::RootedObject function(context,
+ Gjs::Function::create(context, gtype, info));
if (!function)
return NULL;
@@ -1363,6 +1372,6 @@ bool gjs_invoke_constructor_from_c(JSContext* context, GIFunctionInfo* info,
JS::HandleObject obj,
const JS::CallArgs& args,
GIArgument* rvalue) {
- return Function::invoke_constructor_uncached(context, info, obj, args,
- rvalue);
+ return Gjs::Function::invoke_constructor_uncached(context, info, obj, args,
+ rvalue);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]