diff options
author | Marco Trevisan (TreviƱo) <mail@3v1n0.net> | 2020-09-02 19:25:03 +0200 |
---|---|---|
committer | Philip Chimento <philip.chimento@gmail.com> | 2020-09-20 14:55:11 -0700 |
commit | 84cc8d8d7d8d63124ca95b9e87d7f232c6dd1937 (patch) | |
tree | dd40086412cf957e30e6c909d7730c11a13f4dd0 | |
parent | 11a443d78f78af39a76f655fd8d8523f899a4c86 (diff) | |
download | gjs-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.cpp | 6 | ||||
-rw-r--r-- | gi/function.h | 3 |
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 { |