details: https://hg.nginx.org/njs/rev/bc09b884022d branches: changeset: 2334:bc09b884022d user: Dmitry Volyntsev <xei...@nginx.com> date: Tue May 21 23:41:10 2024 -0700 description: Aligned StringIndexOf() implementation with the spec.
When searchValue is empty the function should return early when fromIndex <= len is also true. diffstat: src/njs_string.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diffs (14 lines): diff -r 2d098d2a1c85 -r bc09b884022d src/njs_string.c --- a/src/njs_string.c Tue May 21 23:41:10 2024 -0700 +++ b/src/njs_string.c Tue May 21 23:41:10 2024 -0700 @@ -1710,8 +1710,8 @@ njs_string_index_of(njs_string_prop_t *s length = string->length; - if (njs_slow_path(search->length == 0)) { - return (from < length) ? from : length; + if (search->length == 0 && from <= length) { + return from; } index = from; _______________________________________________ nginx-devel mailing list nginx-devel@nginx.org https://mailman.nginx.org/mailman/listinfo/nginx-devel