Welcome! Log In Create A New Profile

Advanced

[njs] Now ASCII strings use UTF8 variant of PCRE code.

July 11, 2016 08:12AM
details: http://hg.nginx.org/njs/rev/6888c62477a0
branches:
changeset: 117:6888c62477a0
user: Igor Sysoev <igor@sysoev.ru>
date: Fri Jul 08 18:07:57 2016 +0300
description:
Now ASCII strings use UTF8 variant of PCRE code.

diffstat:

njs/njs_regexp.c | 5 ++++-
njs/njs_string.c | 4 ++--
2 files changed, 6 insertions(+), 3 deletions(-)

diffs (55 lines):

diff -r 73dc069a08c0 -r 6888c62477a0 njs/njs_regexp.c
--- a/njs/njs_regexp.c Thu Jul 07 20:49:57 2016 +0300
+++ b/njs/njs_regexp.c Fri Jul 08 18:07:57 2016 +0300
@@ -476,7 +476,7 @@ njs_regexp_prototype_test(njs_vm_t *vm,

(void) njs_string_prop(&string, value);

- n = (string.length != 0 && string.length != string.size);
+ n = (string.length != 0);

pattern = args[0].data.u.regexp->pattern;

@@ -527,14 +527,17 @@ njs_regexp_prototype_exec(njs_vm_t *vm,

(void) njs_string_prop(&string, value);

+ /* Byte string. */
utf8 = 0;
n = 0;

if (string.length != 0) {
+ /* ASCII string. */
utf8 = 1;
n = 1;

if (string.length != string.size) {
+ /* UTF-8 string. */
utf8 = 2;
}
}
diff -r 73dc069a08c0 -r 6888c62477a0 njs/njs_string.c
--- a/njs/njs_string.c Thu Jul 07 20:49:57 2016 +0300
+++ b/njs/njs_string.c Fri Jul 08 18:07:57 2016 +0300
@@ -1450,7 +1450,7 @@ njs_string_prototype_search(njs_vm_t *vm

(void) njs_string_prop(&string, &args[0]);

- n = (string.length != 0 && string.length != string.size);
+ n = (string.length != 0);

if (nxt_regex_is_valid(&pattern->regex[n])) {
ret = nxt_regex_match(&pattern->regex[n], string.start, string.size,
@@ -1696,11 +1696,11 @@ njs_string_prototype_split(njs_vm_t *vm,
if (string.length != 0) {
/* ASCII string. */
utf8 = 1;
- n = 1;

if (string.length != string.size) {
/* UTF-8 string. */
utf8 = 2;
+ n = 1;
}
}


_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[njs] Now ASCII strings use UTF8 variant of PCRE code.

Igor Sysoev 518 July 11, 2016 08:12AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 156
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready