[njs] Making njs_function_closures() inline function.

Dmitry Volyntsev xeioex at nginx.com
Wed Apr 10 14:46:20 UTC 2019


details:   https://hg.nginx.org/njs/rev/dd44fdfef2de
branches:  
changeset: 876:dd44fdfef2de
user:      Dmitry Volyntsev <xeioex at nginx.com>
date:      Wed Apr 10 17:46:14 2019 +0300
description:
Making njs_function_closures() inline function.

diffstat:

 njs/njs_function.c |  17 ++++++++++-------
 1 files changed, 10 insertions(+), 7 deletions(-)

diffs (40 lines):

diff -r 0781f269a0e2 -r dd44fdfef2de njs/njs_function.c
--- a/njs/njs_function.c	Sun Apr 07 13:38:04 2019 +0800
+++ b/njs/njs_function.c	Wed Apr 10 17:46:14 2019 +0300
@@ -9,17 +9,12 @@
 
 
 static njs_function_t *njs_function_copy(njs_vm_t *vm,
-    const njs_function_t *function);
+    njs_function_t *function);
 static njs_native_frame_t *njs_function_frame_alloc(njs_vm_t *vm, size_t size);
 static njs_ret_t njs_normalize_args(njs_vm_t *vm, njs_value_t *args,
     uint8_t *args_types, nxt_uint_t nargs);
 
 
-#define njs_function_closures(vm, function)                                 \
-    (njs_closure_t **) ((function->closure) ? function->closures            \
-                                            : vm->active_frame->closures)
-
-
 njs_function_t *
 njs_function_alloc(njs_vm_t *vm, njs_function_lambda_t *lambda,
     njs_closure_t *closures[], nxt_bool_t shared)
@@ -98,8 +93,16 @@ njs_function_value_copy(njs_vm_t *vm, nj
 }
 
 
+nxt_inline njs_closure_t **
+njs_function_closures(njs_vm_t *vm, njs_function_t *function)
+{
+    return (function->closure) ? function->closures
+                               : vm->active_frame->closures;
+}
+
+
 static njs_function_t *
-njs_function_copy(njs_vm_t *vm, const njs_function_t *function)
+njs_function_copy(njs_vm_t *vm, njs_function_t *function)
 {
     size_t          size;
     nxt_uint_t      n, nesting;


More information about the nginx-devel mailing list