From be540940a32c643198aed4da79c6c6f241c8e99b Mon Sep 17 00:00:00 2001 From: Igor Sysoev Date: Sun, 13 Dec 2015 00:00:30 +0300 Subject: [PATCH] Property enumeration changes. --- nginx/ngx_http_js_module.c | 64 +++++++++++++++++++------------------- njs/njs_disassembler.c | 26 +++++++++------- njs/njs_extern.c | 4 +-- njs/njs_extern.h | 4 +-- njs/njs_generator.c | 42 ++++++++++++------------- njs/njs_parser.c | 11 ++++--- njs/njs_parser.h | 1 - njs/njs_vm.c | 64 +++++++++++++++++++------------------- njs/njs_vm.h | 16 +++++----- njs/njscript.h | 11 +++---- njs/test/njs_unit_test.c | 14 ++++----- 11 files changed, 130 insertions(+), 127 deletions(-) diff --git a/nginx/ngx_http_js_module.c b/nginx/ngx_http_js_module.c index bd5917f4..237971d7 100644 --- a/nginx/ngx_http_js_module.c +++ b/nginx/ngx_http_js_module.c @@ -58,18 +58,18 @@ static njs_ret_t ngx_http_js_ext_get_string(njs_vm_t *vm, njs_value_t *value, void *obj, uintptr_t data); static njs_ret_t ngx_http_js_ext_set_string(njs_vm_t *vm, void *obj, uintptr_t data, nxt_str_t *value); -static njs_ret_t ngx_http_js_ext_each_header_start(njs_vm_t *vm, void *obj, - void *each, uintptr_t data); -static njs_ret_t ngx_http_js_ext_each_header(njs_vm_t *vm, njs_value_t *value, - void *obj, void *each); +static njs_ret_t ngx_http_js_ext_foreach_header(njs_vm_t *vm, void *obj, + void *next, uintptr_t data); +static njs_ret_t ngx_http_js_ext_next_header(njs_vm_t *vm, njs_value_t *value, + void *obj, void *next); static ngx_table_elt_t *ngx_http_js_get_header(ngx_list_part_t *part, u_char *data, size_t len); static njs_ret_t ngx_http_js_ext_get_header_out(njs_vm_t *vm, njs_value_t *value, void *obj, uintptr_t data); static njs_ret_t ngx_http_js_ext_set_header_out(njs_vm_t *vm, void *obj, uintptr_t data, nxt_str_t *value); -static njs_ret_t ngx_http_js_ext_each_header_out_start(njs_vm_t *vm, void *obj, - void *each); /*FIXME*/ +static njs_ret_t ngx_http_js_ext_foreach_header_out(njs_vm_t *vm, void *obj, + void *next); /*FIXME*/ static njs_ret_t ngx_http_js_ext_get_status(njs_vm_t *vm, njs_value_t *value, void *obj, uintptr_t data); static njs_ret_t ngx_http_js_ext_set_status(njs_vm_t *vm, void *obj, @@ -87,14 +87,14 @@ static njs_ret_t ngx_http_js_ext_get_remote_address(njs_vm_t *vm, njs_value_t *value, void *obj, uintptr_t data); static njs_ret_t ngx_http_js_ext_get_header_in(njs_vm_t *vm, njs_value_t *value, void *obj, uintptr_t data); -static njs_ret_t ngx_http_js_ext_each_header_in_start(njs_vm_t *vm, void *obj, - void *each); /*FIXME*/ +static njs_ret_t ngx_http_js_ext_foreach_header_in(njs_vm_t *vm, void *obj, + void *next); /*FIXME*/ static njs_ret_t ngx_http_js_ext_get_arg(njs_vm_t *vm, njs_value_t *value, void *obj, uintptr_t data); -static njs_ret_t ngx_http_js_ext_each_arg_start(njs_vm_t *vm, void *obj, - void *each); -static njs_ret_t ngx_http_js_ext_each_arg(njs_vm_t *vm, njs_value_t *value, - void *obj, void *each); +static njs_ret_t ngx_http_js_ext_foreach_arg(njs_vm_t *vm, void *obj, + void *next); +static njs_ret_t ngx_http_js_ext_next_arg(njs_vm_t *vm, njs_value_t *value, + void *obj, void *next); static char *ngx_http_js_run(ngx_conf_t *cf, ngx_command_t *cmd, void *conf); static char *ngx_http_js_set(ngx_conf_t *cf, ngx_command_t *cmd, void *conf); @@ -175,8 +175,8 @@ static njs_external_t ngx_http_js_ext_response[] = { ngx_http_js_ext_get_header_out, ngx_http_js_ext_set_header_out, NULL, - ngx_http_js_ext_each_header_out_start, - ngx_http_js_ext_each_header, + ngx_http_js_ext_foreach_header_out, + ngx_http_js_ext_next_header, NULL, 0 }, @@ -323,8 +323,8 @@ static njs_external_t ngx_http_js_ext_request[] = { ngx_http_js_ext_get_header_in, NULL, NULL, - ngx_http_js_ext_each_header_in_start, - ngx_http_js_ext_each_header, + ngx_http_js_ext_foreach_header_in, + ngx_http_js_ext_next_header, NULL, 0 }, @@ -335,8 +335,8 @@ static njs_external_t ngx_http_js_ext_request[] = { ngx_http_js_ext_get_arg, NULL, NULL, - ngx_http_js_ext_each_arg_start, - ngx_http_js_ext_each_arg, + ngx_http_js_ext_foreach_arg, + ngx_http_js_ext_next_arg, NULL, 0 }, }; @@ -549,7 +549,7 @@ ngx_http_js_ext_set_string(njs_vm_t *vm, void *obj, uintptr_t data, static njs_ret_t -ngx_http_js_ext_each_header_start(njs_vm_t *vm, void *obj, void *each, +ngx_http_js_ext_foreach_header(njs_vm_t *vm, void *obj, void *next, uintptr_t data) { char *p = obj; @@ -570,7 +570,7 @@ ngx_http_js_ext_each_header_start(njs_vm_t *vm, void *obj, void *each, entry->part = &headers->part; entry->item = 0; - e = (ngx_http_js_table_entry_t **) each; + e = (ngx_http_js_table_entry_t **) next; *e = entry; return NJS_OK; @@ -578,10 +578,10 @@ ngx_http_js_ext_each_header_start(njs_vm_t *vm, void *obj, void *each, static njs_ret_t -ngx_http_js_ext_each_header(njs_vm_t *vm, njs_value_t *value, void *obj, - void *each) +ngx_http_js_ext_next_header(njs_vm_t *vm, njs_value_t *value, void *obj, + void *next) { - ngx_http_js_table_entry_t **e = each; + ngx_http_js_table_entry_t **e = next; ngx_table_elt_t *header, *h; ngx_http_js_table_entry_t *entry; @@ -709,9 +709,9 @@ ngx_http_js_ext_set_header_out(njs_vm_t *vm, void *obj, uintptr_t data, static njs_ret_t -ngx_http_js_ext_each_header_out_start(njs_vm_t *vm, void *obj, void *each) +ngx_http_js_ext_foreach_header_out(njs_vm_t *vm, void *obj, void *next) { - return ngx_http_js_ext_each_header_start(vm, obj, each, + return ngx_http_js_ext_foreach_header(vm, obj, next, offsetof(ngx_http_request_t, headers_out.headers)); } @@ -963,9 +963,9 @@ ngx_http_js_ext_get_header_in(njs_vm_t *vm, njs_value_t *value, void *obj, static njs_ret_t -ngx_http_js_ext_each_header_in_start(njs_vm_t *vm, void *obj, void *each) +ngx_http_js_ext_foreach_header_in(njs_vm_t *vm, void *obj, void *next) { - return ngx_http_js_ext_each_header_start(vm, obj, each, + return ngx_http_js_ext_foreach_header(vm, obj, next, offsetof(ngx_http_request_t, headers_in.headers)); } @@ -989,7 +989,7 @@ ngx_http_js_ext_get_arg(njs_vm_t *vm, njs_value_t *value, void *obj, static njs_ret_t -ngx_http_js_ext_each_arg_start(njs_vm_t *vm, void *obj, void *each) +ngx_http_js_ext_foreach_arg(njs_vm_t *vm, void *obj, void *next) { ngx_str_t *entry, **e; ngx_http_request_t *r; @@ -1003,7 +1003,7 @@ ngx_http_js_ext_each_arg_start(njs_vm_t *vm, void *obj, void *each) *entry = r->args; - e = (ngx_str_t **) each; + e = (ngx_str_t **) next; *e = entry; return NJS_OK; @@ -1011,10 +1011,10 @@ ngx_http_js_ext_each_arg_start(njs_vm_t *vm, void *obj, void *each) static njs_ret_t -ngx_http_js_ext_each_arg(njs_vm_t *vm, njs_value_t *value, void *obj, - void *each) +ngx_http_js_ext_next_arg(njs_vm_t *vm, njs_value_t *value, void *obj, + void *next) { - ngx_str_t **e = each; + ngx_str_t **e = next; size_t len; u_char *p, *start, *end; diff --git a/njs/njs_disassembler.c b/njs/njs_disassembler.c index 2bfc9d82..d61645f4 100644 --- a/njs/njs_disassembler.c +++ b/njs/njs_disassembler.c @@ -179,8 +179,8 @@ njs_disassemble(u_char *start, u_char *end) njs_vmcode_try_start_t *try_start; njs_vmcode_operation_t operation; njs_vmcode_cond_jump_t *cond_jump; - njs_vmcode_prop_each_t *each; - njs_vmcode_prop_start_t *prop_start; + njs_vmcode_prop_next_t *prop_next; + njs_vmcode_prop_foreach_t *prop_foreach; njs_vmcode_method_frame_t *method; p = start; @@ -240,22 +240,24 @@ njs_disassemble(u_char *start, u_char *end) continue; } - if (operation == njs_vmcode_property_each_start) { - prop_start = (njs_vmcode_prop_start_t *) p; - p += sizeof(njs_vmcode_prop_start_t); + if (operation == njs_vmcode_property_foreach) { + prop_foreach = (njs_vmcode_prop_foreach_t *) p; + p += sizeof(njs_vmcode_prop_foreach_t); - printf("PROPERTY START %04lX %04lX +%ld\n", - prop_start->each, prop_start->object, prop_start->offset); + printf("PROPERTY FOREACH %04lX %04lX +%ld\n", + prop_foreach->next, prop_foreach->object, + prop_foreach->offset); continue; } - if (operation == njs_vmcode_property_each) { - each = (njs_vmcode_prop_each_t *) p; - p += sizeof(njs_vmcode_prop_each_t); + if (operation == njs_vmcode_property_next) { + prop_next = (njs_vmcode_prop_next_t *) p; + p += sizeof(njs_vmcode_prop_next_t); - printf("PROPERTY EACH %04lX %04lX %04lX %ld\n", - each->retval, each->object, each->each, each->offset); + printf("PROPERTY NEXT %04lX %04lX %04lX %ld\n", + prop_next->retval, prop_next->object, + prop_next->next, prop_next->offset); continue; } diff --git a/njs/njs_extern.c b/njs/njs_extern.c index 9b060b67..a2ac7846 100644 --- a/njs/njs_extern.c +++ b/njs/njs_extern.c @@ -81,8 +81,8 @@ njs_add_external(nxt_lvlhsh_t *hash, nxt_mem_cache_pool_t *mcp, uintptr_t object ext->get = external->get; ext->set = external->set; ext->find = external->find; - ext->each_start = external->each_start; - ext->each = external->each; + ext->foreach = external->foreach; + ext->next = external->next; ext->method = external->method; ext->object = object; ext->data = external->data; diff --git a/njs/njs_extern.h b/njs/njs_extern.h index fb512b3d..b2a77a3a 100644 --- a/njs/njs_extern.h +++ b/njs/njs_extern.h @@ -21,8 +21,8 @@ struct njs_extern_s { njs_extern_set_t set; njs_extern_find_t find; - njs_extern_each_start_t each_start; - njs_extern_each_t each; + njs_extern_foreach_t foreach; + njs_extern_next_t next; njs_extern_method_t method; diff --git a/njs/njs_generator.c b/njs/njs_generator.c index e6a58560..8f9b0548 100644 --- a/njs/njs_generator.c +++ b/njs/njs_generator.c @@ -671,12 +671,12 @@ static nxt_int_t njs_generate_for_in_statement(njs_vm_t *vm, njs_parser_t *parser, njs_parser_node_t *node) { - u_char *loop; - nxt_int_t ret; - njs_index_t index; - njs_parser_node_t *foreach; - njs_vmcode_prop_each_t *prop_each; - njs_vmcode_prop_start_t *start; + u_char *loop; + nxt_int_t ret; + njs_index_t index; + njs_parser_node_t *foreach; + njs_vmcode_prop_next_t *prop_next; + njs_vmcode_prop_foreach_t *prop_foreach; /* The object. */ @@ -687,14 +687,14 @@ njs_generate_for_in_statement(njs_vm_t *vm, njs_parser_t *parser, return ret; } - njs_generate_code(parser, njs_vmcode_prop_start_t, start); - start->code.operation = njs_vmcode_property_each_start; - start->code.operands = NJS_VMCODE_2OPERANDS; - start->code.retval = NJS_VMCODE_RETVAL; - start->object = foreach->right->index; + njs_generate_code(parser, njs_vmcode_prop_foreach_t, prop_foreach); + prop_foreach->code.operation = njs_vmcode_property_foreach; + prop_foreach->code.operands = NJS_VMCODE_2OPERANDS; + prop_foreach->code.retval = NJS_VMCODE_RETVAL; + prop_foreach->object = foreach->right->index; index = njs_generator_temp_index_get(parser); - start->each = index; + prop_foreach->next = index; /* The loop body. */ @@ -707,21 +707,21 @@ njs_generate_for_in_statement(njs_vm_t *vm, njs_parser_t *parser, /* The loop iterator. */ - start->offset = parser->code_end - (u_char *) start; + prop_foreach->offset = parser->code_end - (u_char *) prop_foreach; ret = njs_generator(vm, parser, node->left->left); if (nxt_slow_path(ret != NXT_OK)) { return ret; } - njs_generate_code(parser, njs_vmcode_prop_each_t, prop_each); - prop_each->code.operation = njs_vmcode_property_each; - prop_each->code.operands = NJS_VMCODE_3OPERANDS; - prop_each->code.retval = NJS_VMCODE_RETVAL; - prop_each->retval = foreach->left->index; - prop_each->object = foreach->right->index; - prop_each->each = index; - prop_each->offset = loop - (u_char *) prop_each; + njs_generate_code(parser, njs_vmcode_prop_next_t, prop_next); + prop_next->code.operation = njs_vmcode_property_next; + prop_next->code.operands = NJS_VMCODE_3OPERANDS; + prop_next->code.retval = NJS_VMCODE_RETVAL; + prop_next->retval = foreach->left->index; + prop_next->object = foreach->right->index; + prop_next->next = index; + prop_next->offset = loop - (u_char *) prop_next; /* * Release object and iterator indexes: an object can be a function result diff --git a/njs/njs_parser.c b/njs/njs_parser.c index 60ebd8d9..d2b407e9 100644 --- a/njs/njs_parser.c +++ b/njs/njs_parser.c @@ -934,12 +934,13 @@ njs_parser_for_in_statement(njs_vm_t *vm, njs_parser_t *parser, { njs_parser_node_t *node; - if (parser->node->left->token != NJS_TOKEN_NAME) { + node = parser->node->left; + + if (node->token != NJS_TOKEN_NAME) { return NJS_TOKEN_ILLEGAL; } - parser->node->left->u.variable->state = NJS_VARIABLE_DECLARED; - parser->node->token = NJS_TOKEN_PROPERTY_EACH; + node->u.variable->state = NJS_VARIABLE_DECLARED; node = njs_parser_node_alloc(vm); if (nxt_slow_path(node == NULL)) { @@ -961,8 +962,8 @@ njs_parser_for_in_statement(njs_vm_t *vm, njs_parser_t *parser, node->right = parser->node; parser->node = node; - parser->code_size += sizeof(njs_vmcode_prop_start_t) - + sizeof(njs_vmcode_prop_each_t); + parser->code_size += sizeof(njs_vmcode_prop_foreach_t) + + sizeof(njs_vmcode_prop_next_t); return token; } diff --git a/njs/njs_parser.h b/njs/njs_parser.h index abb36793..ebb3270c 100644 --- a/njs/njs_parser.h +++ b/njs/njs_parser.h @@ -145,7 +145,6 @@ typedef enum { NJS_TOKEN_DO, NJS_TOKEN_FOR, NJS_TOKEN_FOR_IN, - NJS_TOKEN_PROPERTY_EACH, NJS_TOKEN_BREAK, NJS_TOKEN_CONTINUE, NJS_TOKEN_SWITCH, diff --git a/njs/njs_vm.c b/njs/njs_vm.c index 7860520f..3dfaf4c6 100644 --- a/njs/njs_vm.c +++ b/njs/njs_vm.c @@ -54,10 +54,10 @@ typedef struct { } njs_property_query_t; -typedef struct { +struct njs_property_next_s { int32_t index; nxt_lvlhsh_each_t lhe; -} njs_property_each_t; +}; /* @@ -1083,69 +1083,69 @@ njs_function_private_copy(njs_vm_t *vm, njs_property_query_t *pq) njs_ret_t -njs_vmcode_property_each_start(njs_vm_t *vm, njs_value_t *object, +njs_vmcode_property_foreach(njs_vm_t *vm, njs_value_t *object, njs_value_t *invld) { - njs_ret_t ret; - njs_extern_t *ext; - njs_property_each_t *pe; - njs_vmcode_prop_start_t *code; + njs_ret_t ret; + njs_extern_t *ext; + njs_property_next_t *next; + njs_vmcode_prop_foreach_t *code; if (njs_is_object(object)) { - pe = nxt_mem_cache_alloc(vm->mem_cache_pool, - sizeof(njs_property_each_t)); - if (nxt_slow_path(pe == NULL)) { + next = nxt_mem_cache_alloc(vm->mem_cache_pool, + sizeof(njs_property_next_t)); + if (nxt_slow_path(next == NULL)) { return NXT_ERROR; } - vm->retval.data.u.data = pe; + vm->retval.data.u.next = next; - memset(&pe->lhe, 0, sizeof(nxt_lvlhsh_each_t)); - pe->lhe.proto = &njs_object_hash_proto; - pe->index = -1; + memset(&next->lhe, 0, sizeof(nxt_lvlhsh_each_t)); + next->lhe.proto = &njs_object_hash_proto; + next->index = -1; if (njs_is_array(object) && object->data.u.array->size != 0) { - pe->index = 0; + next->index = 0; } } else if (njs_is_external(object)) { ext = object->data.u.external; - if (ext->each_start != NULL) { - ret = ext->each_start(vm, vm->external[ext->object], &vm->retval); + if (ext->foreach != NULL) { + ret = ext->foreach(vm, vm->external[ext->object], &vm->retval); if (nxt_slow_path(ret != NXT_OK)) { return ret; } } } - code = (njs_vmcode_prop_start_t *) vm->current; + code = (njs_vmcode_prop_foreach_t *) vm->current; return code->offset; } njs_ret_t -njs_vmcode_property_each(njs_vm_t *vm, njs_value_t *object, njs_value_t *each) +njs_vmcode_property_next(njs_vm_t *vm, njs_value_t *object, njs_value_t *value) { njs_ret_t ret; nxt_uint_t n; njs_array_t *array; njs_extern_t *ext; njs_object_prop_t *prop; - njs_property_each_t *pe; - njs_vmcode_prop_each_t *code; + njs_property_next_t *next; + njs_vmcode_prop_next_t *code; - code = (njs_vmcode_prop_each_t *) vm->current; + code = (njs_vmcode_prop_next_t *) vm->current; if (njs_is_object(object)) { - pe = each->data.u.data; + next = value->data.u.next; - if (pe->index >= 0) { + if (next->index >= 0) { array = object->data.u.array; - while ((uint32_t) pe->index < array->size) { - n = pe->index++; + while ((uint32_t) next->index < array->size) { + n = next->index++; if (njs_is_valid(&array->start[n])) { njs_number_set(&vm->retval, n); @@ -1154,10 +1154,10 @@ njs_vmcode_property_each(njs_vm_t *vm, njs_value_t *object, njs_value_t *each) } } - pe->index = -1; + next->index = -1; } - prop = nxt_lvlhsh_each(&object->data.u.object->hash, &pe->lhe); + prop = nxt_lvlhsh_each(&object->data.u.object->hash, &next->lhe); if (prop != NULL) { vm->retval = prop->name; @@ -1165,15 +1165,15 @@ njs_vmcode_property_each(njs_vm_t *vm, njs_value_t *object, njs_value_t *each) return code->offset; } - nxt_mem_cache_free(vm->mem_cache_pool, pe); + nxt_mem_cache_free(vm->mem_cache_pool, next); vm->retval = njs_value_void; } else if (njs_is_external(object)) { ext = object->data.u.external; - if (ext->each != NULL) { - ret = ext->each(vm, &vm->retval, vm->external[ext->object], each); + if (ext->next != NULL) { + ret = ext->next(vm, &vm->retval, vm->external[ext->object], value); if (ret == NXT_OK) { return code->offset; @@ -1187,7 +1187,7 @@ njs_vmcode_property_each(njs_vm_t *vm, njs_value_t *object, njs_value_t *each) } } - return sizeof(njs_vmcode_prop_each_t); + return sizeof(njs_vmcode_prop_next_t); } diff --git a/njs/njs_vm.h b/njs/njs_vm.h index 75ff4238..54cc27a8 100644 --- a/njs/njs_vm.h +++ b/njs/njs_vm.h @@ -87,6 +87,7 @@ typedef struct njs_regexp_s njs_regexp_t; typedef struct njs_regexp_pattern_s njs_regexp_pattern_t; typedef struct njs_extern_s njs_extern_t; typedef struct njs_native_frame_s njs_native_frame_t; +typedef struct njs_property_next_s njs_property_next_t; typedef struct njs_object_s njs_object_t; @@ -172,6 +173,7 @@ union njs_value_s { njs_getter_t getter; njs_extern_t *external; njs_value_t *value; + njs_property_next_t *next; void *data; } u; } data; @@ -473,19 +475,19 @@ typedef struct { typedef struct { njs_vmcode_t code; - njs_index_t each; + njs_index_t next; njs_index_t object; njs_ret_t offset; -} njs_vmcode_prop_start_t; +} njs_vmcode_prop_foreach_t; typedef struct { njs_vmcode_t code; njs_index_t retval; njs_index_t object; - njs_index_t each; + njs_index_t next; njs_ret_t offset; -} njs_vmcode_prop_each_t; +} njs_vmcode_prop_next_t; typedef struct { @@ -734,10 +736,10 @@ njs_ret_t njs_vmcode_property_in(njs_vm_t *vm, njs_value_t *property, njs_value_t *object); njs_ret_t njs_vmcode_property_delete(njs_vm_t *vm, njs_value_t *object, njs_value_t *property); -njs_ret_t njs_vmcode_property_each_start(njs_vm_t *vm, njs_value_t *object, +njs_ret_t njs_vmcode_property_foreach(njs_vm_t *vm, njs_value_t *object, njs_value_t *invld); -njs_ret_t njs_vmcode_property_each(njs_vm_t *vm, njs_value_t *object, - njs_value_t *each); +njs_ret_t njs_vmcode_property_next(njs_vm_t *vm, njs_value_t *object, + njs_value_t *value); njs_ret_t njs_vmcode_instance_of(njs_vm_t *vm, njs_value_t *object, njs_value_t *constructor); diff --git a/njs/njscript.h b/njs/njscript.h index f412d2eb..e5ebe06f 100644 --- a/njs/njscript.h +++ b/njs/njscript.h @@ -33,10 +33,9 @@ typedef njs_ret_t (*njs_extern_set_t)(njs_vm_t *vm, void *obj, uintptr_t data, nxt_str_t *value); typedef njs_ret_t (*njs_extern_find_t)(njs_vm_t *vm, void *obj, uintptr_t data, nxt_bool_t delete); -typedef njs_ret_t (*njs_extern_each_start_t)(njs_vm_t *vm, void *obj, - void *each); -typedef njs_ret_t (*njs_extern_each_t)(njs_vm_t *vm, njs_value_t *value, - void *obj, void *each); +typedef njs_ret_t (*njs_extern_foreach_t)(njs_vm_t *vm, void *obj, void *next); +typedef njs_ret_t (*njs_extern_next_t)(njs_vm_t *vm, njs_value_t *value, + void *obj, void *next); typedef njs_ret_t (*njs_extern_method_t)(njs_vm_t *vm, njs_param_t *param); @@ -59,8 +58,8 @@ struct njs_external_s { njs_extern_set_t set; njs_extern_find_t find; - njs_extern_each_start_t each_start; - njs_extern_each_t each; + njs_extern_foreach_t foreach; + njs_extern_next_t next; njs_extern_method_t method; diff --git a/njs/test/njs_unit_test.c b/njs/test/njs_unit_test.c index 77de64fc..9f652905 100644 --- a/njs/test/njs_unit_test.c +++ b/njs/test/njs_unit_test.c @@ -3269,11 +3269,11 @@ njs_unit_test_header_external(njs_vm_t *vm, njs_value_t *value, void *obj, static njs_ret_t -njs_unit_test_header_each_start_external(njs_vm_t *vm, void *obj, void *each) +njs_unit_test_header_foreach_external(njs_vm_t *vm, void *obj, void *next) { u_char *s; - s = each; + s = next; s[0] = '0'; s[1] = '0'; @@ -3282,12 +3282,12 @@ njs_unit_test_header_each_start_external(njs_vm_t *vm, void *obj, void *each) static njs_ret_t -njs_unit_test_header_each_external(njs_vm_t *vm, njs_value_t *value, void *obj, - void *each) +njs_unit_test_header_next_external(njs_vm_t *vm, njs_value_t *value, void *obj, + void *next) { u_char *s; - s = each; + s = next; s[1]++; if (s[1] == '4') { @@ -3368,8 +3368,8 @@ static njs_external_t njs_unit_test_r_external[] = { njs_unit_test_header_external, NULL, NULL, - njs_unit_test_header_each_start_external, - njs_unit_test_header_each_external, + njs_unit_test_header_foreach_external, + njs_unit_test_header_next_external, NULL, 0 }, -- 2.47.3