diff options
author | Konstantin Pavlov <thresh@nginx.com> | 2024-12-19 10:23:57 -0800 |
---|---|---|
committer | Konstantin Pavlov <thresh@nginx.com> | 2024-12-19 10:23:57 -0800 |
commit | d8acad350a52a20918c46c09cb0a0f5479400923 (patch) | |
tree | 7d9c4b64daa60d3ac121743dfa3735c6fc5687a4 /src/nxt_tstr.c | |
parent | 624debcf17ea7faab01fa841bd4dcd9f308cf306 (diff) | |
parent | 27bde184dedcbf687db2f314c60c037623318a8d (diff) | |
download | unit-d8acad350a52a20918c46c09cb0a0f5479400923.tar.gz unit-d8acad350a52a20918c46c09cb0a0f5479400923.tar.bz2 |
Merge tag '1.34.0' into packaging1.34.0-1
Unit 1.34.0 release.
Diffstat (limited to 'src/nxt_tstr.c')
-rw-r--r-- | src/nxt_tstr.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/nxt_tstr.c b/src/nxt_tstr.c index 50df4c47..d939d44e 100644 --- a/src/nxt_tstr.c +++ b/src/nxt_tstr.c @@ -41,10 +41,6 @@ struct nxt_tstr_query_s { }; -#define nxt_tstr_is_js(str) \ - nxt_strchr_start(str, '`') - - nxt_tstr_state_t * nxt_tstr_state_new(nxt_mp_t *mp, nxt_bool_t test) { @@ -80,16 +76,17 @@ nxt_tstr_compile(nxt_tstr_state_t *state, const nxt_str_t *str, { u_char *p; nxt_tstr_t *tstr; - nxt_bool_t strz; + nxt_bool_t strz, newline; strz = (flags & NXT_TSTR_STRZ) != 0; + newline = (flags & NXT_TSTR_NEWLINE) != 0; tstr = nxt_mp_get(state->pool, sizeof(nxt_tstr_t)); if (nxt_slow_path(tstr == NULL)) { return NULL; } - tstr->str.length = str->length + strz; + tstr->str.length = str->length + newline + strz; tstr->str.start = nxt_mp_nget(state->pool, tstr->str.length); if (nxt_slow_path(tstr->str.start == NULL)) { @@ -98,6 +95,10 @@ nxt_tstr_compile(nxt_tstr_state_t *state, const nxt_str_t *str, p = nxt_cpymem(tstr->str.start, str->start, str->length); + if (newline) { + *p++ = '\n'; + } + if (strz) { *p = '\0'; } @@ -114,7 +115,7 @@ nxt_tstr_compile(nxt_tstr_state_t *state, const nxt_str_t *str, nxt_tstr_str(tstr, &tpl); - tstr->u.js = nxt_js_add_tpl(state->jcf, &tpl, strz); + tstr->u.js = nxt_js_add_tpl(state->jcf, &tpl, flags); if (nxt_slow_path(tstr->u.js == NULL)) { return NULL; } |