Welcome! Log In Create A New Profile

Advanced

[njs] Avoiding modification of vm->retval in njs_add_event().

Dmitry Volyntsev
December 16, 2020 03:30PM
details: https://hg.nginx.org/njs/rev/d8e94445f59b
branches:
changeset: 1583:d8e94445f59b
user: Dmitry Volyntsev <xeioex@nginx.com>
date: Wed Dec 16 20:27:43 2020 +0000
description:
Avoiding modification of vm->retval in njs_add_event().

diffstat:

src/njs_event.c | 2 --
src/njs_timer.c | 6 +++++-
2 files changed, 5 insertions(+), 3 deletions(-)

diffs (28 lines):

diff -r 1f862b9dec16 -r d8e94445f59b src/njs_event.c
--- a/src/njs_event.c Wed Dec 16 20:27:31 2020 +0000
+++ b/src/njs_event.c Wed Dec 16 20:27:43 2020 +0000
@@ -62,8 +62,6 @@ njs_add_event(njs_vm_t *vm, njs_event_t
return NJS_ERROR;
}

- njs_set_number(&vm->retval, vm->event_id - 1);
-
return NJS_OK;
}

diff -r 1f862b9dec16 -r d8e94445f59b src/njs_timer.c
--- a/src/njs_timer.c Wed Dec 16 20:27:31 2020 +0000
+++ b/src/njs_timer.c Wed Dec 16 20:27:43 2020 +0000
@@ -68,7 +68,11 @@ njs_set_timer(njs_vm_t *vm, njs_value_t
return NJS_ERROR;
}

- return njs_add_event(vm, event);
+ if (njs_add_event(vm, event) == NJS_OK) {
+ njs_set_number(&vm->retval, vm->event_id - 1);
+ }
+
+ return NJS_OK;

memory_error:

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

[njs] Avoiding modification of vm->retval in njs_add_event().

Dmitry Volyntsev 100 December 16, 2020 03:30PM



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

Online Users

Guests: 51
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready