summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarco Trevisan (TreviƱo) <mail@3v1n0.net>2020-09-02 19:25:03 +0200
committerPhilip Chimento <philip.chimento@gmail.com>2020-09-20 14:55:11 -0700
commit84cc8d8d7d8d63124ca95b9e87d7f232c6dd1937 (patch)
treedd40086412cf957e30e6c909d7730c11a13f4dd0
parent11a443d78f78af39a76f655fd8d8523f899a4c86 (diff)
downloadgjs-84cc8d8d7d8d63124ca95b9e87d7f232c6dd1937.tar.gz
function: Make gjs_callback_trampoline_ref to return the struct
This mimics GOBject and other GLib structs, and can be useful with auto-pointers.
-rw-r--r--gi/function.cpp6
-rw-r--r--gi/function.h3
2 files changed, 5 insertions, 4 deletions
diff --git a/gi/function.cpp b/gi/function.cpp
index db6df6f9..f3408da4 100644
--- a/gi/function.cpp
+++ b/gi/function.cpp
@@ -91,10 +91,10 @@ static GSList *completed_trampolines = NULL; /* GjsCallbackTrampoline */
GJS_DEFINE_PRIV_FROM_JS(Function, gjs_function_class)
-void
-gjs_callback_trampoline_ref(GjsCallbackTrampoline *trampoline)
-{
+GjsCallbackTrampoline* gjs_callback_trampoline_ref(
+ GjsCallbackTrampoline* trampoline) {
trampoline->ref_count++;
+ return trampoline;
}
void
diff --git a/gi/function.h b/gi/function.h
index fdc11324..2b2ea106 100644
--- a/gi/function.h
+++ b/gi/function.h
@@ -66,7 +66,8 @@ GjsCallbackTrampoline* gjs_callback_trampoline_new(
GIScopeType scope, bool has_scope_object, bool is_vfunc);
void gjs_callback_trampoline_unref(GjsCallbackTrampoline *trampoline);
-void gjs_callback_trampoline_ref(GjsCallbackTrampoline *trampoline);
+GjsCallbackTrampoline* gjs_callback_trampoline_ref(
+ GjsCallbackTrampoline* trampoline);
// Stack allocation only!
struct GjsFunctionCallState {