Bug 827581: Unify JS_GetStringCharsZAndLength with JS_GetStringCharsAndLength. r=wmccloskey
authorJim Blandy <jimb@mozilla.com>
Fri, 22 Feb 2013 16:07:14 -0800
changeset 122698 3d74e00b4f4f63fbf3cc414cc5f0e5547d210775
parent 122697 f46e28183c028a70d7664f3d0eb197588097d7c6
child 122699 64d47c0e35a89e9b2e10c79edcb0c9ef2b18aaf1
push id23446
push userjblandy@mozilla.com
push dateSat, 23 Feb 2013 00:09:35 +0000
treeherdermozilla-inbound@3d74e00b4f4f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerswmccloskey
bugs827581
milestone22.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 827581: Unify JS_GetStringCharsZAndLength with JS_GetStringCharsAndLength. r=wmccloskey
js/src/jsapi.cpp
--- a/js/src/jsapi.cpp
+++ b/js/src/jsapi.cpp
@@ -5967,23 +5967,18 @@ JS_PUBLIC_API(size_t)
 JS_GetStringLength(JSString *str)
 {
     return str->length();
 }
 
 JS_PUBLIC_API(const jschar *)
 JS_GetStringCharsZ(JSContext *cx, JSString *str)
 {
-    AssertHeapIsIdleOrStringIsFlat(cx, str);
-    CHECK_REQUEST(cx);
-    assertSameCompartment(cx, str);
-    JSFlatString *flat = str->ensureFlat(cx);
-    if (!flat)
-        return NULL;
-    return flat->chars();
+    size_t dummy;
+    return JS_GetStringCharsZAndLength(cx, str, &dummy);
 }
 
 JS_PUBLIC_API(const jschar *)
 JS_GetStringCharsZAndLength(JSContext *cx, JSString *str, size_t *plength)
 {
     JS_ASSERT(plength);
     AssertHeapIsIdleOrStringIsFlat(cx, str);
     CHECK_REQUEST(cx);