Welcome! Log In Create A New Profile

Advanced

[njs] Aligned StringIndexOf() implementation with the spec.

Dmitry Volyntsev
May 22, 2024 12:42PM
details: https://hg.nginx.org/njs/rev/bc09b884022d
branches:
changeset: 2334:bc09b884022d
user: Dmitry Volyntsev <xeioex@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
Subject Author Views Posted

[njs] Aligned StringIndexOf() implementation with the spec.

Dmitry Volyntsev 165 May 22, 2024 12:42PM



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

Online Users

Guests: 159
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready