[gjs/mozjs78: 10/21] Replace FlatString(s) with LinearString.
- From: Evan Welsh <ewlsh src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs/mozjs78: 10/21] Replace FlatString(s) with LinearString.
- Date: Sun, 5 Jul 2020 03:36:00 +0000 (UTC)
commit 4a1234f9e198c0706b1bf1025a7b4b6396c094b4
Author: Evan Welsh <noreply evanwelsh com>
Date: Sat Jul 4 22:15:59 2020 -0500
Replace FlatString(s) with LinearString.
gjs/jsapi-util-string.cpp | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
---
diff --git a/gjs/jsapi-util-string.cpp b/gjs/jsapi-util-string.cpp
index 43a71284..6d046534 100644
--- a/gjs/jsapi-util-string.cpp
+++ b/gjs/jsapi-util-string.cpp
@@ -340,7 +340,8 @@ bool gjs_get_string_id(JSContext* cx, jsid id, JS::UniqueChars* name_p) {
return true;
}
- JS::RootedString s(cx, JS_FORGET_STRING_FLATNESS(JSID_TO_FLAT_STRING(id)));
+ JSLinearString* lstr = JSID_TO_LINEAR_STRING(id);
+ JS::RootedString s(cx, JS_FORGET_STRING_LINEARNESS(lstr));
*name_p = JS_EncodeStringToUTF8(cx, s);
return !!*name_p;
}
@@ -381,10 +382,7 @@ gjs_intern_string_to_id(JSContext *cx,
}
GJS_USE
-static std::string
-gjs_debug_flat_string(JSFlatString *fstr)
-{
- JSLinearString *str = js::FlatStringToLinearString(fstr);
+static std::string gjs_debug_linear_string(JSLinearString* str) {
size_t len = js::GetLinearStringLength(str);
JS::AutoCheckCannotGC nogc;
@@ -416,12 +414,12 @@ gjs_debug_string(JSString *str)
{
if (!str)
return "<null string>";
- if (!JS_StringIsFlat(str)) {
+ if (!JS_StringIsLinear(str)) {
std::ostringstream out("<non-flat string of length ");
out << JS_GetStringLength(str) << '>';
return out.str();
}
- return gjs_debug_flat_string(JS_ASSERT_STRING_IS_FLAT(str));
+ return gjs_debug_linear_string(JS_ASSERT_STRING_IS_LINEAR(str));
}
std::string
@@ -522,6 +520,6 @@ std::string
gjs_debug_id(jsid id)
{
if (JSID_IS_STRING(id))
- return gjs_debug_flat_string(JSID_TO_FLAT_STRING(id));
+ return gjs_debug_linear_string(JSID_TO_LINEAR_STRING(id));
return gjs_debug_value(js::IdToValue(id));
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]