]> git.kaiwu.me - njs.git/commit
RegExp: improved source string treatment.
authorDmitry Volyntsev <xeioex@nginx.com>
Thu, 11 Nov 2021 14:26:41 +0000 (14:26 +0000)
committerDmitry Volyntsev <xeioex@nginx.com>
Thu, 11 Nov 2021 14:26:41 +0000 (14:26 +0000)
commitee235811515fee1fe277ab42f7e29a1b69a76508
tree182f86682ed7af5f1596478bff325f9719eab19b
parentad652679ea3e2972ffcd355bac199502c00e5d5d
RegExp: improved source string treatment.

Previously, njs_regexp_pattern_create() in addition to a pattern
compilation made a string representation for a RegExp which was returned
by RegExp.prototype.toString() as is.

After 02444445df29 (0.6.0), RegExp.prototype.toString() was implemented
according to the spec, and since then it creates a RegExp string on the fly.

This patch removes the extra code which was left.

In addition, as a source string may not be a valid UTF-8 string (in
RegExp literals), RegExp.prototype.toString() now ensures that a
valid UTF-8 string is returned.
src/njs_regexp.c
src/njs_regexp_pattern.h