[gjs] Fix gcc 4.6 warnings



commit f3e6ff89ce85e6f96ad42cdbb9d0be6cbbe11eff
Author: Colin Walters <walters verbum org>
Date:   Fri Feb 4 18:14:34 2011 -0500

    Fix gcc 4.6 warnings
    
    gjs/jsapi-util.c:823:11: warning: 'bytes' may be used uninitialized in this function [-Wuninitialized]
    gjs/stack.c:181:15: warning: 'value' may be used uninitialized in this function [-Wuninitialized]
    gjs/stack.c:180:15: warning: 'name' may be used uninitialized in this function [-Wuninitialized]

 gjs/jsapi-util.c |    2 ++
 gjs/stack.c      |    4 ++--
 2 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/gjs/jsapi-util.c b/gjs/jsapi-util.c
index 948f917..27260ca 100644
--- a/gjs/jsapi-util.c
+++ b/gjs/jsapi-util.c
@@ -815,6 +815,8 @@ gjs_value_debug_string(JSContext      *context,
         bytes = g_malloc((len + 1) * sizeof(char));
         JS_EncodeStringToBuffer(str, bytes, len);
         bytes[len] = '\0';
+    } else {
+        bytes = g_strdup("[invalid string]");
     }
 #endif
     JS_EndRequest(context);
diff --git a/gjs/stack.c b/gjs/stack.c
index 90d15b6..56bebd8 100644
--- a/gjs/stack.c
+++ b/gjs/stack.c
@@ -157,8 +157,8 @@ format_frame(JSContext* cx, JSStackFrame* fp,
         g_string_append_printf(buf, "%d <TOP LEVEL>", num);
 
     for (i = 0; i < call_props.length; i++) {
-        char *name;
-        char *value;
+        char *name = NULL;
+        char *value = NULL;
         JSPropertyDesc* desc = &call_props.array[i];
         if(desc->flags & JSPD_ARGUMENT) {
             name = jsvalue_to_string(cx, desc->id, &is_string);



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