diff --git a/lib/addon.cc b/lib/addon.cc index 7d0abc7..318250a 100644 --- a/lib/addon.cc +++ b/lib/addon.cc @@ -168,8 +168,8 @@ const StrVal& WrappedRE2::prepareArgument(const v8::Local &arg, bool void StrVal::setIndex(size_t newIndex) { - isIndexValid = newIndex <= length; - if (!isIndexValid) + isValidIndex = newIndex <= length; + if (!isValidIndex) { index = newIndex; byteIndex = 0; diff --git a/lib/exec.cc b/lib/exec.cc index e9d69f6..29729f8 100644 --- a/lib/exec.cc +++ b/lib/exec.cc @@ -19,7 +19,7 @@ NAN_METHOD(WrappedRE2::Exec) if (re2->global || re2->sticky) { - if (!str.isIndexValid) + if (!str.isValidIndex) { re2->lastIndex = 0; info.GetReturnValue().SetNull(); diff --git a/lib/match.cc b/lib/match.cc index 54babf0..59176dc 100644 --- a/lib/match.cc +++ b/lib/match.cc @@ -17,7 +17,7 @@ NAN_METHOD(WrappedRE2::Match) auto str = re2->prepareArgument(info[0], re2->global); if (str.isBad) return; // throws an exception - if (!str.isIndexValid) + if (!str.isValidIndex) { re2->lastIndex = 0; info.GetReturnValue().SetNull(); diff --git a/lib/replace.cc b/lib/replace.cc index 171ae03..c012e6c 100644 --- a/lib/replace.cc +++ b/lib/replace.cc @@ -500,7 +500,7 @@ NAN_METHOD(WrappedRE2::Replace) auto replacee = re2->prepareArgument(info[0]); if (replacee.isBad) return; // throws an exception - if (!replacee.isIndexValid) + if (!replacee.isValidIndex) { info.GetReturnValue().Set(info[0]); return; diff --git a/lib/test.cc b/lib/test.cc index 66fe7bf..8abf584 100644 --- a/lib/test.cc +++ b/lib/test.cc @@ -23,7 +23,7 @@ NAN_METHOD(WrappedRE2::Test) return; } - if (!str.isIndexValid) + if (!str.isValidIndex) { re2->lastIndex = 0; info.GetReturnValue().SetNull(); diff --git a/lib/wrapped_re2.h b/lib/wrapped_re2.h index 22d43fa..6a6c1c3 100644 --- a/lib/wrapped_re2.h +++ b/lib/wrapped_re2.h @@ -9,9 +9,9 @@ struct StrVal char *data; size_t size, length; size_t index, byteIndex; - bool isBuffer, isIndexValid, isBad; + bool isBuffer, isValidIndex, isBad; - StrVal() : data(NULL), size(0), length(0), index(0), byteIndex(0), isBuffer(false), isIndexValid(false), isBad(false) {} + StrVal() : data(NULL), size(0), length(0), index(0), byteIndex(0), isBuffer(false), isValidIndex(false), isBad(false) {} operator re2::StringPiece() const { return re2::StringPiece(data, size); } @@ -20,7 +20,7 @@ struct StrVal void clear() { - isBad = isBuffer = isIndexValid = false; + isBad = isBuffer = isValidIndex = false; size = length = index = byteIndex = 0; data = nullptr; }