[njs] Introduced njs_chb_append_str() as inline function.

Dmitry Volyntsev xeioex at nginx.com
Wed Jul 22 11:27:41 UTC 2020


details:   https://hg.nginx.org/njs/rev/a9e536ca9b69
branches:  
changeset: 1473:a9e536ca9b69
user:      Dmitry Volyntsev <xeioex at nginx.com>
date:      Wed Jul 22 11:27:18 2020 +0000
description:
Introduced njs_chb_append_str() as inline function.

To catch erroneous passing of njs_string_prop_t (instead of njs_str_t)
in compile time.

diffstat:

 src/njs_chb.h |  10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r 855edd76bdb6 -r a9e536ca9b69 src/njs_chb.h
--- a/src/njs_chb.h	Wed Jul 15 19:19:19 2020 +0300
+++ b/src/njs_chb.h	Wed Jul 22 11:27:18 2020 +0000
@@ -43,9 +43,6 @@ void njs_chb_destroy(njs_chb_t *chain);
 #define njs_chb_append_literal(chain, literal)                               \
     njs_chb_append0(chain, literal, njs_length(literal))
 
-#define njs_chb_append_str(chain, str)                                       \
-    njs_chb_append0(chain, (const char *) (str)->start, (str)->length)
-
 
 #define njs_chb_node_size(n) (size_t) ((n)->pos - (n)->start)
 #define njs_chb_node_room(n) (size_t) ((n)->end - (n)->pos)
@@ -61,6 +58,13 @@ njs_chb_init(njs_chb_t *chain, njs_mp_t 
 }
 
 
+njs_inline void
+njs_chb_append_str(njs_chb_t *chain, njs_str_t *str)
+{
+    njs_chb_append0(chain, (const char *) str->start, str->length);
+}
+
+
 njs_inline int64_t
 njs_chb_size(njs_chb_t *chain)
 {


More information about the nginx-devel mailing list