[gjs] function.c: Quiet some compiler warnings



commit 1e71f30df3ae7147b3d38e1c680a82c656c0d845
Author: Colin Walters <walters verbum org>
Date:   Thu Sep 16 17:18:38 2010 -0400

    function.c: Quiet some compiler warnings
    
    As far as I can see GCC simply isn't inferring that one boolean
    is always set in the failure flow path, but initializing these
    anyways is good practice.

 gi/function.c |    7 ++-----
 1 files changed, 2 insertions(+), 5 deletions(-)
---
diff --git a/gi/function.c b/gi/function.c
index 846cd4f..b8aa2a0 100644
--- a/gi/function.c
+++ b/gi/function.c
@@ -384,8 +384,8 @@ gjs_invoke_c_function(JSContext      *context,
     gboolean is_method;
     GITypeInfo return_info;
     GITypeTag return_tag;
-    jsval *return_values;
-    guint8 next_rval;
+    jsval *return_values = NULL;
+    guint8 next_rval = 0; /* index into return_values */
     GSList *iter;
     GjsCallbackTrampoline *callback_trampoline;
     void *destroy_notify;
@@ -577,9 +577,6 @@ gjs_invoke_c_function(JSContext      *context,
 
     *js_rval = JSVAL_VOID;
 
-    next_rval = 0; /* index into return_values */
-
-    return_values = NULL; /* Quiet gcc warning about initialization */
     /* Only process return values if the function didn't throw */
     if (function->js_out_argc > 0 && !did_throw_gerror) {
         return_values = g_newa(jsval, function->js_out_argc);



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