Bug 1403911 - Part 14: Move JSSubString struct to its remaining callers. r=jandem
authorAndré Bargull <andre.bargull@gmail.com>
Tue, 03 Oct 2017 16:11:08 +0200
changeset 426810 6cc39e017590a7c2adae1db874e949c11ec01a54
parent 426809 eff4be681f2b435380033255ffa7f9e8e88abcf1
child 426811 9da8518c5abef0572c6072052c3c7414923e7e46
push id97
push userfmarier@mozilla.com
push dateSat, 14 Oct 2017 01:12:59 +0000
reviewersjandem
bugs1403911
milestone58.0a1
Bug 1403911 - Part 14: Move JSSubString struct to its remaining callers. r=jandem
js/src/builtin/RegExp.cpp
js/src/jsstr.h
--- a/js/src/builtin/RegExp.cpp
+++ b/js/src/builtin/RegExp.cpp
@@ -1201,16 +1201,35 @@ js::regexp_test_no_statics(JSContext* cx
     RegExpRunStatus status = ExecuteRegExp(cx, regexp, string, 0,
                                            nullptr, &ignored, DontUpdateRegExpStatics);
     args.rval().setBoolean(status == RegExpRunStatus_Success);
     return status != RegExpRunStatus_Error;
 }
 
 using CapturesVector = GCVector<Value, 4>;
 
+struct JSSubString
+{
+    JSLinearString* base;
+    size_t          offset;
+    size_t          length;
+
+    JSSubString() { mozilla::PodZero(this); }
+
+    void initEmpty(JSLinearString* base) {
+        this->base = base;
+        offset = length = 0;
+    }
+    void init(JSLinearString* base, size_t offset, size_t length) {
+        this->base = base;
+        this->offset = offset;
+        this->length = length;
+    }
+};
+
 static void
 GetParen(JSLinearString* matched, const JS::Value& capture, JSSubString* out)
 {
     if (capture.isUndefined()) {
         out->initEmpty(matched);
         return;
     }
     JSLinearString& captureLinear = capture.toString()->asLinear();
--- a/js/src/jsstr.h
+++ b/js/src/jsstr.h
@@ -63,34 +63,16 @@ CompareChars(const Char1* s1, size_t len
     return int32_t(len1 - len2);
 }
 
 extern int32_t
 CompareChars(const char16_t* s1, size_t len1, JSLinearString* s2);
 
 }  /* namespace js */
 
-struct JSSubString {
-    JSLinearString* base;
-    size_t          offset;
-    size_t          length;
-
-    JSSubString() { mozilla::PodZero(this); }
-
-    void initEmpty(JSLinearString* base) {
-        this->base = base;
-        offset = length = 0;
-    }
-    void init(JSLinearString* base, size_t offset, size_t length) {
-        this->base = base;
-        this->offset = offset;
-        this->length = length;
-    }
-};
-
 /*
  * Shorthands for ASCII (7-bit) decimal and hex conversion.
  * Manually inline isdigit and isxdigit for performance; MSVC doesn't do this for us.
  */
 #define JS7_ISDEC(c)    ((((unsigned)(c)) - '0') <= 9)
 #define JS7_ISA2F(c)    ((((((unsigned)(c)) - 'a') <= 5) || (((unsigned)(c)) - 'A') <= 5))
 #define JS7_UNDEC(c)    ((c) - '0')
 #define JS7_ISOCT(c)    ((((unsigned)(c)) - '0') <= 7)