[gjs: 1/12] function: Make gjs_callback_trampoline_ref to return the struct




commit 84cc8d8d7d8d63124ca95b9e87d7f232c6dd1937
Author: Marco Trevisan (TreviƱo) <mail 3v1n0 net>
Date:   Wed Sep 2 19:25:03 2020 +0200

    function: Make gjs_callback_trampoline_ref to return the struct
    
    This mimics GOBject and other GLib structs, and can be useful with
    auto-pointers.

 gi/function.cpp | 6 +++---
 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 {


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