[njs] Making njs_arg() available for external value methods.

Dmitry Volyntsev xeioex at nginx.com
Mon Jul 30 17:00:51 UTC 2018


details:   http://hg.nginx.org/njs/rev/8840fd0ff685
branches:  
changeset: 573:8840fd0ff685
user:      Dmitry Volyntsev <xeioex at nginx.com>
date:      Mon Jul 30 20:00:20 2018 +0300
description:
Making njs_arg() available for external value methods.

diffstat:

 njs/njs.h          |  7 +++++++
 njs/njs_function.h |  3 ---
 2 files changed, 7 insertions(+), 3 deletions(-)

diffs (30 lines):

diff -r 058162fce59a -r 8840fd0ff685 njs/njs.h
--- a/njs/njs.h	Fri Jul 27 17:01:52 2018 +0300
+++ b/njs/njs.h	Mon Jul 30 20:00:20 2018 +0300
@@ -44,6 +44,13 @@ typedef struct {
 #define njs_argument(args, n)                                                 \
     (njs_value_t *) ((u_char *) args + n * 16)
 
+
+extern const njs_value_t            njs_value_void;
+
+#define njs_arg(args, nargs, n)                                               \
+    (njs_value_t *) ((n < nargs) ? njs_argument(args, n)                      \
+                                 : &njs_value_void)
+
 #define njs_value_assign(dst, src)                                            \
     *((njs_opaque_value_t *) dst) = *((njs_opaque_value_t *) src);
 
diff -r 058162fce59a -r 8840fd0ff685 njs/njs_function.h
--- a/njs/njs_function.h	Fri Jul 27 17:01:52 2018 +0300
+++ b/njs/njs_function.h	Mon Jul 30 20:00:20 2018 +0300
@@ -40,9 +40,6 @@ struct njs_function_lambda_s {
 };
 
 
-#define njs_arg(args, nargs, n)                                               \
-    ((n < nargs) ? &(args)[n] : &njs_value_void)
-
 /* The frame size must be aligned to njs_value_t. */
 #define NJS_NATIVE_FRAME_SIZE                                                 \
     nxt_align_size(sizeof(njs_native_frame_t), sizeof(njs_value_t))


More information about the nginx-devel mailing list