[gjs] More fixes for previous commit
- From: Colin Walters <walters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs] More fixes for previous commit
- Date: Wed, 15 Dec 2010 23:55:02 +0000 (UTC)
commit 08ed898f10ee888497708299f28d91fc67602699
Author: Colin Walters <walters verbum org>
Date: Wed Dec 15 18:52:13 2010 -0500
More fixes for previous commit
* Change to always malloc() to avoid compiler warnings
* Add missing brackets to fix control flow
gjs/stack.c | 10 ++++------
1 files changed, 4 insertions(+), 6 deletions(-)
---
diff --git a/gjs/stack.c b/gjs/stack.c
index 92b589d..90d15b6 100644
--- a/gjs/stack.c
+++ b/gjs/stack.c
@@ -83,7 +83,6 @@ format_frame(JSContext* cx, JSStackFrame* fp,
JSPropertyDescArray call_props = { 0, NULL };
JSObject* this_obj = NULL;
JSObject* call_obj = NULL;
- JSString* funname = NULL;
char* funname_str = NULL;
const char* filename = NULL;
guint32 lineno = 0;
@@ -115,14 +114,15 @@ format_frame(JSContext* cx, JSStackFrame* fp,
filename = JS_GetScriptFilename(cx, script);
lineno = (guint32) JS_PCToLineNumber(cx, script, pc);
fun = JS_GetFrameFunction(cx, fp);
- if (fun)
+ if (fun) {
#ifdef HAVE_JS_GETFUNCTIONNAME
- funname_str = JS_GetFunctionName(fun);
+ funname_str = g_strdup(JS_GetFunctionName(fun));
#else
- funname = JS_GetFunctionId(fun);
+ JSString* funname = JS_GetFunctionId(fun);
if (funname)
funname_str = gjs_string_get_ascii(cx, STRING_TO_JSVAL(funname));
#endif
+ }
call_obj = JS_GetFrameCallObject(cx, fp);
if (call_obj) {
@@ -149,9 +149,7 @@ format_frame(JSContext* cx, JSStackFrame* fp,
if (funname_str) {
g_string_append_printf(buf, "%d %s(", num, funname_str);
-#ifndef HAVE_JS_GETFUNCTIONNAME
g_free(funname_str);
-#endif
}
else if (fun)
g_string_append_printf(buf, "%d anonymous(", num);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]