[njs] Improved parser scope filename.
Dmitry Volyntsev
xeioex at nginx.com
Tue Feb 26 15:24:31 UTC 2019
details: https://hg.nginx.org/njs/rev/7345fd14d1b4
branches:
changeset: 808:7345fd14d1b4
user: hongzhidao <hongzhidao at gmail.com>
date: Tue Feb 26 17:30:02 2019 +0800
description:
Improved parser scope filename.
diffstat:
njs/njs_parser.c | 11 +++++------
1 files changed, 5 insertions(+), 6 deletions(-)
diffs (30 lines):
diff -r 1d6e32892413 -r 7345fd14d1b4 njs/njs_parser.c
--- a/njs/njs_parser.c Tue Feb 26 17:32:59 2019 +0800
+++ b/njs/njs_parser.c Tue Feb 26 17:30:02 2019 +0800
@@ -164,9 +164,9 @@ njs_parser(njs_vm_t *vm, njs_parser_t *p
static njs_ret_t
njs_parser_scope_begin(njs_vm_t *vm, njs_parser_t *parser, njs_scope_t type)
{
- nxt_int_t ret;
nxt_uint_t nesting;
nxt_array_t *values;
+ njs_lexer_t *lexer;
njs_parser_scope_t *scope, *parent;
nesting = 0;
@@ -233,11 +233,10 @@ njs_parser_scope_begin(njs_vm_t *vm, njs
scope->values[0] = values;
scope->values[1] = NULL;
- if (parser->lexer->file.length != 0) {
- ret = njs_name_copy(vm, &scope->file, &parser->lexer->file);
- if (nxt_slow_path(ret != NXT_OK)) {
- return NXT_ERROR;
- }
+ lexer = parser->lexer;
+
+ if (lexer->file.length != 0) {
+ nxt_file_basename(&lexer->file, &scope->file);
}
parent = parser->scope;
More information about the nginx-devel
mailing list