Bug 700740 - Remove 'out' label from obj_toSource; r=jorendorff
authorMs2ger <ms2ger@gmail.com>
Wed, 16 Nov 2011 08:50:20 +0100
changeset 81960 d51bd1645a2ff60806622ce7529e93301b69f336
parent 81959 303f996ba1424d8f72dc068d6454cf70db9acff1
child 81981 30161b298513513dba7fc9dfcfcd915fd244ba46
push idunknown
push userunknown
push dateunknown
reviewersjorendorff
bugs700740
milestone11.0a1
Bug 700740 - Remove 'out' label from obj_toSource; r=jorendorff
js/src/jsobj.cpp
--- a/js/src/jsobj.cpp
+++ b/js/src/jsobj.cpp
@@ -496,17 +496,16 @@ js_TraceSharpMap(JSTracer *trc, JSSharpO
     JS_HashTableEnumerateEntries(map->table, gc_sharp_table_entry_marker, trc);
 }
 
 #if JS_HAS_TOSOURCE
 static JSBool
 obj_toSource(JSContext *cx, uintN argc, Value *vp)
 {
     JSBool ok;
-    JSHashEntry *he;
     JSIdArray *ida;
     jschar *chars, *ochars, *vsharp;
     const jschar *idstrchars, *vchars;
     size_t nchars, idstrlength, gsoplength, vlength, vsharplength, curlen;
     const char *comma;
     JSObject *obj2;
     JSProperty *prop;
     Value *val;
@@ -522,20 +521,20 @@ obj_toSource(JSContext *cx, uintN argc, 
 
     /* If outermost, we need parentheses to be an expression, not a block. */
     JSBool outermost = (cx->sharpObjectMap.depth == 0);
 
     JSObject *obj = ToObject(cx, &vp[1]);
     if (!obj)
         return false;
 
-    if (!(he = js_EnterSharpObject(cx, obj, &ida, &chars))) {
-        ok = JS_FALSE;
-        goto out;
-    }
+    JSHashEntry *he = js_EnterSharpObject(cx, obj, &ida, &chars);
+    if (!he)
+        return false;
+
     if (!ida) {
         /*
          * We didn't enter -- obj is already "sharp", meaning we've visited it
          * already in our depth first search, and therefore chars contains a
          * string of the form "#n#".
          */
         JS_ASSERT(IS_SHARP(he));
 #if JS_HAS_SHARP_VARS
@@ -811,35 +810,31 @@ obj_toSource(JSContext *cx, uintN argc, 
     chars[nchars] = 0;
 
   error:
     js_LeaveSharpObject(cx, &ida);
 
     if (!ok) {
         if (chars)
             Foreground::free_(chars);
-        goto out;
+        return false;
     }
 
     if (!chars) {
         JS_ReportOutOfMemory(cx);
-        ok = JS_FALSE;
-        goto out;
+        return false;
     }
   make_string:
     str = js_NewString(cx, chars, nchars);
     if (!str) {
         cx->free_(chars);
-        ok = JS_FALSE;
-        goto out;
+        return false;
     }
     vp->setString(str);
-    ok = JS_TRUE;
-  out:
-    return ok;
+    return true;
 
   overflow:
     cx->free_(vsharp);
     cx->free_(chars);
     chars = NULL;
     goto error;
 }
 #endif /* JS_HAS_TOSOURCE */