summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lstrlib.js21
1 files changed, 5 insertions, 16 deletions
diff --git a/src/lstrlib.js b/src/lstrlib.js
index 23b0404..6a0da58 100644
--- a/src/lstrlib.js
+++ b/src/lstrlib.js
@@ -1113,22 +1113,11 @@ const push_captures = function(ms, s, e) {
};
const nospecials = function(p, l) {
- let upto = 0;
- do {
- let special = false;
- let supto = p.slice(upto);
- for (let i = 0; i < SPECIALS.length; i++) {
- if (supto.indexOf(SPECIALS[i]) > -1) {
- special = true;
- break;
- }
- }
-
- if (special)
- return false; /* pattern has a special character */
- upto = upto + 1; /* may have more after \0 */
- } while (upto <= l);
- return true; /* no special chars found */
+ for (let i=0; i<l; i++) {
+ if (SPECIALS.indexOf(p[i]) !== -1)
+ return false;
+ }
+ return true;
};
const prepstate = function(ms, L, s, ls, p, lp) {