[njs] Style.

2024-01-29 Thread Dmitry Volyntsev
details:   https://hg.nginx.org/njs/rev/fca50ba4db9d
branches:  
changeset: 2278:fca50ba4db9d
user:  Dmitry Volyntsev 
date:  Mon Jan 29 17:16:08 2024 -0800
description:
Style.

diffstat:

 src/njs_builtin.c |   2 +-
 src/njs_clang.h   |  26 +-
 2 files changed, 14 insertions(+), 14 deletions(-)

diffs (48 lines):

diff -r 478795e3296b -r fca50ba4db9d src/njs_builtin.c
--- a/src/njs_builtin.c Mon Jan 29 17:16:07 2024 -0800
+++ b/src/njs_builtin.c Mon Jan 29 17:16:08 2024 -0800
@@ -28,7 +28,7 @@ static njs_int_t njs_global_this_prop_ha
 static njs_arr_t *njs_vm_expression_completions(njs_vm_t *vm,
 njs_str_t *expression);
 static njs_arr_t *njs_vm_global_var_completions(njs_vm_t *vm,
-   njs_str_t *expression);
+njs_str_t *expression);
 static njs_arr_t *njs_object_completions(njs_vm_t *vm, njs_value_t *object,
 njs_str_t *expression);
 static njs_int_t njs_env_hash_init(njs_vm_t *vm, njs_lvlhsh_t *hash,
diff -r 478795e3296b -r fca50ba4db9d src/njs_clang.h
--- a/src/njs_clang.h   Mon Jan 29 17:16:07 2024 -0800
+++ b/src/njs_clang.h   Mon Jan 29 17:16:08 2024 -0800
@@ -193,19 +193,19 @@ njs_leading_zeros64(uint64_t x)
 njs_inline NJS_NOSANITIZE("float-cast-overflow") int64_t
 njs_unsafe_cast_double_to_int64(double num)
 {
-   /*
-* Casting NaN to integer is undefined behavior,
-* but it is fine in some cases where we do additional checks later.
-* For example:
-*  int64_t i64 = njs_unsafe_cast_double_to_int64(num);
-*  if (i64 == num) {
-*// num is integer
-*  }
-*
-* We do this as inline function to avoid UndefinedBehaviorSanitizer
-* warnings.
-*/
-   return (int64_t) num;
+/*
+ * Casting NaN to integer is undefined behavior,
+ * but it is fine in some cases where we do additional checks later.
+ * For example:
+ *  int64_t i64 = njs_unsafe_cast_double_to_int64(num);
+ *  if (i64 == num) {
+ *// num is integer
+ *  }
+ *
+ * We do this as inline function to avoid UndefinedBehaviorSanitizer
+ * warnings.
+ */
+return (int64_t) num;
 }
 
 
___
nginx-devel mailing list
nginx-devel@nginx.org
https://mailman.nginx.org/mailman/listinfo/nginx-devel


[njs] Style.

2022-09-29 Thread Dmitry Volyntsev
details:   https://hg.nginx.org/njs/rev/60cf808fe4ff
branches:  
changeset: 1968:60cf808fe4ff
user:  Dmitry Volyntsev 
date:  Thu Sep 29 00:35:34 2022 -0700
description:
Style.

diffstat:

 src/njs_array.c   |  11 ---
 src/njs_object_prop.c |   9 ++---
 2 files changed, 14 insertions(+), 6 deletions(-)

diffs (61 lines):

diff -r 1137ad409fee -r 60cf808fe4ff src/njs_array.c
--- a/src/njs_array.c   Tue Sep 27 16:52:31 2022 -0700
+++ b/src/njs_array.c   Thu Sep 29 00:35:34 2022 -0700
@@ -173,7 +173,8 @@ njs_array_convert_to_slow_array(njs_vm_t
 
 
 njs_int_t
-njs_array_length_redefine(njs_vm_t *vm, njs_value_t *value, uint32_t length, 
int writable)
+njs_array_length_redefine(njs_vm_t *vm, njs_value_t *value, uint32_t length,
+int writable)
 {
 njs_object_prop_t  *prop;
 
@@ -1631,14 +1632,18 @@ njs_array_indices_handler(const void *fi
 njs_string_get(val1, );
 njs_string_get(val2, );
 
-cmp_res =  strncmp((const char *) str1.start, (const char *) str2.start,
-   njs_min(str1.length, str2.length));
+cmp_res = strncmp((const char *) str1.start, (const char *) str2.start,
+  njs_min(str1.length, str2.length));
+
 if (cmp_res == 0) {
 if (str1.length < str2.length) {
 return -1;
+
 } else if (str1.length > str2.length) {
 return 1;
+
 } else {
+
 return 0;
 }
 }
diff -r 1137ad409fee -r 60cf808fe4ff src/njs_object_prop.c
--- a/src/njs_object_prop.c Tue Sep 27 16:52:31 2022 -0700
+++ b/src/njs_object_prop.c Thu Sep 29 00:35:34 2022 -0700
@@ -467,9 +467,11 @@ done:
 
 if (prev->configurable != 1 &&
 prev->writable != 1 &&
-!njs_values_strict_equal(>value, 
>value))
+!njs_values_strict_equal(>value,
+ >value))
 {
-njs_type_error(vm, "Cannot redefine property: 
\"length\"");
+njs_type_error(vm, "Cannot redefine "
+   "property: \"length\"");
 return NJS_ERROR;
 }
 
@@ -477,7 +479,8 @@ done:
 prev->writable = prop->writable;
 }
 
-return njs_array_length_set(vm, object, prev, 
>value);
+return njs_array_length_set(vm, object, prev,
+>value);
 }
 }
 }
___
nginx-devel mailing list -- nginx-devel@nginx.org
To unsubscribe send an email to nginx-devel-le...@nginx.org


[njs] Style: removed excessive empty line intoduced in 3acc8a1d9088.

2022-07-14 Thread Dmitry Volyntsev
details:   https://hg.nginx.org/njs/rev/36a6dfe84da4
branches:  
changeset: 1907:36a6dfe84da4
user:  Dmitry Volyntsev 
date:  Thu Jul 14 20:16:34 2022 -0700
description:
Style: removed excessive empty line intoduced in 3acc8a1d9088.

diffstat:

 src/njs_string.c |  1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diffs (11 lines):

diff -r 3acc8a1d9088 -r 36a6dfe84da4 src/njs_string.c
--- a/src/njs_string.c  Tue Jul 12 08:56:35 2022 -0700
+++ b/src/njs_string.c  Thu Jul 14 20:16:34 2022 -0700
@@ -316,7 +316,6 @@ njs_encode_hex_length(const njs_str_t *s
 void
 njs_encode_base64(njs_str_t *dst, const njs_str_t *src)
 {
-
 njs_encode_base64_core(dst, src, njs_basis64_enc, 1);
 }
 
___
nginx-devel mailing list -- nginx-devel@nginx.org
To unsubscribe send an email to nginx-devel-le...@nginx.org


[njs] Style.

2021-10-14 Thread Dmitry Volyntsev
details:   https://hg.nginx.org/njs/rev/9502fed1bd6b
branches:  
changeset: 1724:9502fed1bd6b
user:  Dmitry Volyntsev 
date:  Thu Oct 14 15:18:47 2021 +
description:
Style.

diffstat:

 nginx/ngx_http_js_module.c   |  24 
 nginx/ngx_stream_js_module.c |  24 
 2 files changed, 24 insertions(+), 24 deletions(-)

diffs (134 lines):

diff -r 1b63a726fcea -r 9502fed1bd6b nginx/ngx_http_js_module.c
--- a/nginx/ngx_http_js_module.cWed Oct 13 16:31:00 2021 +
+++ b/nginx/ngx_http_js_module.cThu Oct 14 15:18:47 2021 +
@@ -233,7 +233,7 @@ static char *ngx_http_js_merge_loc_conf(
 void *child);
 
 #if (NGX_HTTP_SSL)
-static char * ngx_http_js_set_ssl(ngx_conf_t *cf, ngx_http_js_loc_conf_t 
*plcf);
+static char * ngx_http_js_set_ssl(ngx_conf_t *cf, ngx_http_js_loc_conf_t 
*jlcf);
 #endif
 static ngx_ssl_t *ngx_http_js_ssl(njs_vm_t *vm, ngx_http_request_t *r);
 
@@ -4087,7 +4087,7 @@ ngx_http_js_merge_loc_conf(ngx_conf_t *c
 #if (NGX_HTTP_SSL)
 
 static char *
-ngx_http_js_set_ssl(ngx_conf_t *cf, ngx_http_js_loc_conf_t *plcf)
+ngx_http_js_set_ssl(ngx_conf_t *cf, ngx_http_js_loc_conf_t *jlcf)
 {
 ngx_ssl_t   *ssl;
 ngx_pool_cleanup_t  *cln;
@@ -4097,10 +4097,10 @@ ngx_http_js_set_ssl(ngx_conf_t *cf, ngx_
 return NGX_CONF_ERROR;
 }
 
-plcf->ssl = ssl;
+jlcf->ssl = ssl;
 ssl->log = cf->log;
 
-if (ngx_ssl_create(ssl, plcf->ssl_protocols, NULL) != NGX_OK) {
+if (ngx_ssl_create(ssl, jlcf->ssl_protocols, NULL) != NGX_OK) {
 return NGX_CONF_ERROR;
 }
 
@@ -4113,12 +4113,12 @@ ngx_http_js_set_ssl(ngx_conf_t *cf, ngx_
 cln->handler = ngx_ssl_cleanup_ctx;
 cln->data = ssl;
 
-if (ngx_ssl_ciphers(NULL, ssl, >ssl_ciphers, 0) != NGX_OK) {
+if (ngx_ssl_ciphers(NULL, ssl, >ssl_ciphers, 0) != NGX_OK) {
 return NGX_CONF_ERROR;
 }
 
-if (ngx_ssl_trusted_certificate(cf, ssl, >ssl_trusted_certificate,
-plcf->ssl_verify_depth)
+if (ngx_ssl_trusted_certificate(cf, ssl, >ssl_trusted_certificate,
+jlcf->ssl_verify_depth)
 != NGX_OK)
 {
 return NGX_CONF_ERROR;
@@ -4134,11 +4134,11 @@ static ngx_ssl_t *
 ngx_http_js_ssl(njs_vm_t *vm, ngx_http_request_t *r)
 {
 #if (NGX_HTTP_SSL)
-ngx_http_js_loc_conf_t   *plcf;
-
-plcf = ngx_http_get_module_loc_conf(r, ngx_http_js_module);
-
-return plcf->ssl;
+ngx_http_js_loc_conf_t  *jlcf;
+
+jlcf = ngx_http_get_module_loc_conf(r, ngx_http_js_module);
+
+return jlcf->ssl;
 #else
 return NULL;
 #endif
diff -r 1b63a726fcea -r 9502fed1bd6b nginx/ngx_stream_js_module.c
--- a/nginx/ngx_stream_js_module.c  Wed Oct 13 16:31:00 2021 +
+++ b/nginx/ngx_stream_js_module.c  Thu Oct 14 15:18:47 2021 +
@@ -147,7 +147,7 @@ static ngx_int_t ngx_stream_js_init(ngx_
 
 #if (NGX_SSL)
 static char * ngx_stream_js_set_ssl(ngx_conf_t *cf,
-ngx_stream_js_srv_conf_t *pscf);
+ngx_stream_js_srv_conf_t *jscf);
 #endif
 static ngx_ssl_t *ngx_stream_js_ssl(njs_vm_t *vm, ngx_stream_session_t *s);
 
@@ -2060,7 +2060,7 @@ ngx_stream_js_init(ngx_conf_t *cf)
 #if (NGX_SSL)
 
 static char *
-ngx_stream_js_set_ssl(ngx_conf_t *cf, ngx_stream_js_srv_conf_t *pscf)
+ngx_stream_js_set_ssl(ngx_conf_t *cf, ngx_stream_js_srv_conf_t *jscf)
 {
 ngx_ssl_t   *ssl;
 ngx_pool_cleanup_t  *cln;
@@ -2070,10 +2070,10 @@ ngx_stream_js_set_ssl(ngx_conf_t *cf, ng
 return NGX_CONF_ERROR;
 }
 
-pscf->ssl = ssl;
+jscf->ssl = ssl;
 ssl->log = cf->log;
 
-if (ngx_ssl_create(ssl, pscf->ssl_protocols, NULL) != NGX_OK) {
+if (ngx_ssl_create(ssl, jscf->ssl_protocols, NULL) != NGX_OK) {
 return NGX_CONF_ERROR;
 }
 
@@ -2086,12 +2086,12 @@ ngx_stream_js_set_ssl(ngx_conf_t *cf, ng
 cln->handler = ngx_ssl_cleanup_ctx;
 cln->data = ssl;
 
-if (ngx_ssl_ciphers(NULL, ssl, >ssl_ciphers, 0) != NGX_OK) {
+if (ngx_ssl_ciphers(NULL, ssl, >ssl_ciphers, 0) != NGX_OK) {
 return NGX_CONF_ERROR;
 }
 
-if (ngx_ssl_trusted_certificate(cf, ssl, >ssl_trusted_certificate,
- pscf->ssl_verify_depth)
+if (ngx_ssl_trusted_certificate(cf, ssl, >ssl_trusted_certificate,
+jscf->ssl_verify_depth)
 != NGX_OK)
 {
 return NGX_CONF_ERROR;
@@ -2107,11 +2107,11 @@ static ngx_ssl_t *
 ngx_stream_js_ssl(njs_vm_t *vm, ngx_stream_session_t *s)
 {
 #if (NGX_SSL)
-ngx_stream_js_srv_conf_t   *pscf;
-
-pscf = ngx_stream_get_module_srv_conf(s, ngx_stream_js_module);
-
-return pscf->ssl;
+ngx_stream_js_srv_conf_t  *jscf;
+
+jscf = ngx_stream_get_module_srv_conf(s, ngx_stream_js_module);
+
+return jscf->ssl;
 #else
 return NULL;
 #endif
___
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel


[njs] Style.

2021-10-06 Thread Dmitry Volyntsev
details:   https://hg.nginx.org/njs/rev/5aceb5eaf2b2
branches:  
changeset: 1713:5aceb5eaf2b2
user:  Dmitry Volyntsev 
date:  Wed Oct 06 13:16:09 2021 +
description:
Style.

diffstat:

 nginx/ngx_js.h |  8 
 1 files changed, 4 insertions(+), 4 deletions(-)

diffs (27 lines):

diff -r 15a26b25a328 -r 5aceb5eaf2b2 nginx/ngx_js.h
--- a/nginx/ngx_js.hWed Oct 06 15:57:14 2021 +0300
+++ b/nginx/ngx_js.hWed Oct 06 13:16:09 2021 +
@@ -22,7 +22,7 @@
 
 typedef ngx_pool_t *(*ngx_external_pool_pt)(njs_vm_t *vm, njs_external_ptr_t 
e);
 typedef void (*ngx_js_event_handler_pt)(njs_external_ptr_t e,
-   njs_vm_event_t vm_event, njs_value_t *args, njs_uint_t nargs);
+njs_vm_event_t vm_event, njs_value_t *args, njs_uint_t nargs);
 typedef ngx_resolver_t *(*ngx_external_resolver_pt)(njs_vm_t *vm,
 njs_external_ptr_t e);
 typedef ngx_msec_t (*ngx_external_resolver_timeout_pt)(njs_vm_t *vm,
@@ -33,11 +33,11 @@ typedef ngx_ssl_t *(*ngx_external_ssl_pt
 #define ngx_external_connection(vm, e)\
 (*((ngx_connection_t **) ((u_char *) (e) + njs_vm_meta(vm, 0
 #define ngx_external_pool(vm, e)  \
-   ((ngx_external_pool_pt) njs_vm_meta(vm, 1))(vm, e)
+((ngx_external_pool_pt) njs_vm_meta(vm, 1))(vm, e)
 #define ngx_external_resolver(vm, e)  \
-   ((ngx_external_resolver_pt) njs_vm_meta(vm, 2))(vm, e)
+((ngx_external_resolver_pt) njs_vm_meta(vm, 2))(vm, e)
 #define ngx_external_resolver_timeout(vm, e)  \
-   ((ngx_external_resolver_timeout_pt) njs_vm_meta(vm, 3))(vm, e)
+((ngx_external_resolver_timeout_pt) njs_vm_meta(vm, 3))(vm, e)
 #define ngx_external_event_handler(vm, e) \
 ((ngx_js_event_handler_pt) njs_vm_meta(vm, 4))
 #define ngx_external_ssl(vm, e)   \
___
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel


[njs] Style.

2021-09-20 Thread Dmitry Volyntsev
details:   https://hg.nginx.org/njs/rev/d1a43dc93e9d
branches:  
changeset: 1706:d1a43dc93e9d
user:  Dmitry Volyntsev 
date:  Fri Sep 17 18:29:40 2021 +
description:
Style.

diffstat:

 src/njs_buffer.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r 91d9301684db -r d1a43dc93e9d src/njs_buffer.c
--- a/src/njs_buffer.c  Fri Sep 03 14:57:50 2021 +
+++ b/src/njs_buffer.c  Fri Sep 17 18:29:40 2021 +
@@ -663,12 +663,12 @@ njs_buffer_compare_array(njs_vm_t *vm, n
 njs_int_t  ret;
 njs_typed_array_t  *source, *target;
 
-source = njs_buffer_slot(vm , val1, "source");
+source = njs_buffer_slot(vm, val1, "source");
 if (njs_slow_path(source == NULL)) {
 return NJS_ERROR;
 }
 
-target = njs_buffer_slot(vm , val2, "target");
+target = njs_buffer_slot(vm, val2, "target");
 if (njs_slow_path(target == NULL)) {
 return NJS_ERROR;
 }
@@ -868,7 +868,7 @@ njs_buffer_is_buffer(njs_vm_t *vm, njs_v
 
 is = 0;
 
-array = njs_buffer_slot(vm , njs_arg(args, nargs, 1), "source");
+array = njs_buffer_slot(vm, njs_arg(args, nargs, 1), "source");
 
 if (njs_fast_path(array != NULL && array->object.__proto__
   == >prototypes[NJS_OBJ_TYPE_BUFFER].object))
___
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel


[njs] Style.

2021-05-31 Thread Dmitry Volyntsev
details:   https://hg.nginx.org/njs/rev/fc510b2e4f3a
branches:  
changeset: 1645:fc510b2e4f3a
user:  Dmitry Volyntsev 
date:  Fri May 28 15:23:03 2021 +
description:
Style.

diffstat:

 auto/clang |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (16 lines):

diff -r f3eac82832aa -r fc510b2e4f3a auto/clang
--- a/auto/clangFri May 28 14:00:04 2021 +
+++ b/auto/clangFri May 28 15:23:03 2021 +
@@ -123,9 +123,9 @@ njs_feature_path=
 njs_feature_libs=
 njs_feature_test="int n __attribute__ ((aligned(64)));
 
- int main(void) {
- return 0;
- }"
+  int main(void) {
+return 0;
+  }"
 . auto/feature
 
 
___
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel


[njs] Style.

2020-07-14 Thread Dmitry Volyntsev
details:   https://hg.nginx.org/njs/rev/3dc7a53d9f00
branches:  
changeset: 1468:3dc7a53d9f00
user:  Dmitry Volyntsev 
date:  Tue Jul 14 17:21:53 2020 +
description:
Style.

diffstat:

 src/njs_parser.c  |  2 +-
 src/njs_typed_array.c |  2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diffs (24 lines):

diff -r 42d20205e054 -r 3dc7a53d9f00 src/njs_parser.c
--- a/src/njs_parser.c  Tue Jul 14 17:20:29 2020 +
+++ b/src/njs_parser.c  Tue Jul 14 17:21:53 2020 +
@@ -3140,7 +3140,7 @@ njs_parser_left_hand_side_expression_opt
 
 static njs_int_t
 njs_parser_expression_node(njs_parser_t *parser, njs_lexer_token_t *token,
-   njs_queue_link_t *current, njs_token_type_t type,
+njs_queue_link_t *current, njs_token_type_t type,
 njs_vmcode_operation_t operation, njs_parser_state_func_t after)
 {
 njs_parser_node_t  *node;
diff -r 42d20205e054 -r 3dc7a53d9f00 src/njs_typed_array.c
--- a/src/njs_typed_array.c Tue Jul 14 17:20:29 2020 +
+++ b/src/njs_typed_array.c Tue Jul 14 17:21:53 2020 +
@@ -597,7 +597,7 @@ njs_typed_array_prototype_fill(njs_vm_t 
 for (i = start; i < end; i++) {
 buffer->u.f64[i + offset] = num;
 }
-   }
+}
 
 return NJS_OK;
 }
___
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel


[njs] Style: removing excessive commentaries.

2020-02-17 Thread Dmitry Volyntsev
details:   https://hg.nginx.org/njs/rev/cbc09d7edfc8
branches:  
changeset: 1327:cbc09d7edfc8
user:  Dmitry Volyntsev 
date:  Mon Feb 17 16:18:18 2020 +0300
description:
Style: removing excessive commentaries.

diffstat:

 src/njs_array.c|  10 ---
 src/njs_array_buffer.c |   5 ---
 src/njs_boolean.c  |   3 --
 src/njs_date.c |   3 --
 src/njs_dtoa_fixed.c   |  10 ---
 src/njs_error.c|  27 ---
 src/njs_function.c |  10 ---
 src/njs_math.c |  17 
 src/njs_number.c   |  12 
 src/njs_object.c   |  26 --
 src/njs_regexp.c   |   3 --
 src/njs_string.c   |  69 --
 src/njs_symbol.c   |  18 -
 13 files changed, 0 insertions(+), 213 deletions(-)

diffs (truncated from 1324 to 1000 lines):

diff -r 13dbdff9b76f -r cbc09d7edfc8 src/njs_array.c
--- a/src/njs_array.c   Mon Feb 17 16:13:43 2020 +0300
+++ b/src/njs_array.c   Mon Feb 17 16:18:18 2020 +0300
@@ -444,7 +444,6 @@ njs_array_of(njs_vm_t *vm, njs_value_t *
 
 static const njs_object_prop_t  njs_array_constructor_properties[] =
 {
-/* Array.name == "Array". */
 {
 .type = NJS_PROPERTY,
 .name = njs_string("name"),
@@ -452,7 +451,6 @@ static const njs_object_prop_t  njs_arra
 .configurable = 1,
 },
 
-/* Array.length == 1. */
 {
 .type = NJS_PROPERTY,
 .name = njs_string("length"),
@@ -460,14 +458,12 @@ static const njs_object_prop_t  njs_arra
 .configurable = 1,
 },
 
-/* Array.prototype. */
 {
 .type = NJS_PROPERTY_HANDLER,
 .name = njs_string("prototype"),
 .value = njs_prop_handler(njs_object_prototype_create),
 },
 
-/* Array.isArray(). */
 {
 .type = NJS_PROPERTY,
 .name = njs_string("isArray"),
@@ -476,8 +472,6 @@ static const njs_object_prop_t  njs_arra
 .configurable = 1,
 },
 
-/* ES6. */
-/* Array.of(). */
 {
 .type = NJS_PROPERTY,
 .name = njs_string("of"),
@@ -3403,7 +3397,6 @@ static const njs_object_prop_t  njs_arra
 .configurable = 1,
 },
 
-/* ES7. */
 {
 .type = NJS_PROPERTY,
 .name = njs_string("includes"),
@@ -3436,7 +3429,6 @@ static const njs_object_prop_t  njs_arra
 .configurable = 1,
 },
 
-/* ES6. */
 {
 .type = NJS_PROPERTY,
 .name = njs_string("fill"),
@@ -3453,7 +3445,6 @@ static const njs_object_prop_t  njs_arra
 .configurable = 1,
 },
 
-/* ES6. */
 {
 .type = NJS_PROPERTY,
 .name = njs_string("find"),
@@ -3462,7 +3453,6 @@ static const njs_object_prop_t  njs_arra
 .configurable = 1,
 },
 
-/* ES6. */
 {
 .type = NJS_PROPERTY,
 .name = njs_string("findIndex"),
diff -r 13dbdff9b76f -r cbc09d7edfc8 src/njs_array_buffer.c
--- a/src/njs_array_buffer.cMon Feb 17 16:13:43 2020 +0300
+++ b/src/njs_array_buffer.cMon Feb 17 16:18:18 2020 +0300
@@ -112,7 +112,6 @@ njs_array_buffer_is_view(njs_vm_t *vm, n
 
 static const njs_object_prop_t  njs_array_buffer_constructor_properties[] =
 {
-/* ArrayBuffer.name == "ArrayBuffer". */
 {
 .type = NJS_PROPERTY,
 .name = njs_string("name"),
@@ -120,7 +119,6 @@ static const njs_object_prop_t  njs_arra
 .configurable = 1,
 },
 
-/* ArrayBuffer.length == 1. */
 {
 .type = NJS_PROPERTY,
 .name = njs_string("length"),
@@ -128,14 +126,12 @@ static const njs_object_prop_t  njs_arra
 .configurable = 1,
 },
 
-/* ArrayBuffer.prototype. */
 {
 .type = NJS_PROPERTY_HANDLER,
 .name = njs_string("prototype"),
 .value = njs_prop_handler(njs_object_prototype_create),
 },
 
-/* ArrayBuffer[Symbol.species] */
 {
 .type = NJS_PROPERTY,
 .name = njs_wellknown_symbol(NJS_SYMBOL_SPECIES),
@@ -147,7 +143,6 @@ static const njs_object_prop_t  njs_arra
 .enumerable = 0,
 },
 
-/* ArrayBuffer.isView(new Uint8Array()) === true */
 {
 .type = NJS_PROPERTY,
 .name = njs_string("isView"),
diff -r 13dbdff9b76f -r cbc09d7edfc8 src/njs_boolean.c
--- a/src/njs_boolean.c Mon Feb 17 16:13:43 2020 +0300
+++ b/src/njs_boolean.c Mon Feb 17 16:18:18 2020 +0300
@@ -40,7 +40,6 @@ njs_boolean_constructor(njs_vm_t *vm, nj
 
 static const njs_object_prop_t  njs_boolean_constructor_properties[] =
 {
-/* Boolean.name == "Boolean". */
 {
 .type = NJS_PROPERTY,
 .name = njs_string("name"),
@@ -48,7 +47,6 @@ static const njs_object_prop_t  njs_bool
 .configurable = 1,
 },
 
-/* Boolean.length == 1. */
 {
 .type = NJS_PROPERTY,
 .name = njs_string("length"),
@@ -56,7 +54,6 @@ static const njs_object_prop_t  njs_bool
 .configurable = 1,
 },
 
-/* Boolean.prototype. */
 {
 .type = 

[njs] Style.

2019-12-03 Thread Alexander Borisov
details:   https://hg.nginx.org/njs/rev/da7cff928b80
branches:  
changeset: 1274:da7cff928b80
user:  Alexander Borisov 
date:  Tue Dec 03 16:44:03 2019 +0300
description:
Style.

diffstat:

 src/njs_diyfp.h |  4 ++--
 src/njs_value.c |  1 +
 src/njs_value.h |  6 ++
 3 files changed, 5 insertions(+), 6 deletions(-)

diffs (45 lines):

diff -r afe38b7fabe4 -r da7cff928b80 src/njs_diyfp.h
--- a/src/njs_diyfp.h   Tue Dec 03 16:43:04 2019 +0300
+++ b/src/njs_diyfp.h   Tue Dec 03 16:44:03 2019 +0300
@@ -19,8 +19,8 @@ typedef struct {
 
 
 typedef union {
-   double  d;
-   uint64_tu64;
+double  d;
+uint64_tu64;
 } njs_diyfp_conv_t;
 
 
diff -r afe38b7fabe4 -r da7cff928b80 src/njs_value.c
--- a/src/njs_value.c   Tue Dec 03 16:43:04 2019 +0300
+++ b/src/njs_value.c   Tue Dec 03 16:44:03 2019 +0300
@@ -1251,6 +1251,7 @@ njs_value_to_object(njs_vm_t *vm, njs_va
 return NJS_ERROR;
 }
 
+
 void
 njs_symbol_conversion_failed(njs_vm_t *vm, njs_bool_t to_string)
 {
diff -r afe38b7fabe4 -r da7cff928b80 src/njs_value.h
--- a/src/njs_value.h   Tue Dec 03 16:43:04 2019 +0300
+++ b/src/njs_value.h   Tue Dec 03 16:44:03 2019 +0300
@@ -907,14 +907,12 @@ njs_int_t njs_value_property_delete(njs_
 njs_value_t *key, njs_value_t *removed);
 njs_int_t njs_value_to_object(njs_vm_t *vm, njs_value_t *value);
 
+void njs_symbol_conversion_failed(njs_vm_t *vm, njs_bool_t to_string);
+
 
 #include "njs_number.h"
 
 
-void
-njs_symbol_conversion_failed(njs_vm_t *vm, njs_bool_t to_string);
-
-
 njs_inline njs_int_t
 njs_value_to_number(njs_vm_t *vm, njs_value_t *value, double *dst)
 {
___
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel


[njs] Style.

2019-11-11 Thread Dmitry Volyntsev
details:   https://hg.nginx.org/njs/rev/71decc0d345c
branches:  
changeset: 1228:71decc0d345c
user:  Dmitry Volyntsev 
date:  Fri Nov 08 20:33:46 2019 +0300
description:
Style.

diffstat:

 nginx/ngx_http_js_module.c |  2 +-
 src/njs_object_prop.c  |  4 ++--
 src/njs_value.c|  2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diffs (39 lines):

diff -r de6c3c68e18e -r 71decc0d345c nginx/ngx_http_js_module.c
--- a/nginx/ngx_http_js_module.cFri Nov 08 16:29:34 2019 +0300
+++ b/nginx/ngx_http_js_module.cFri Nov 08 20:33:46 2019 +0300
@@ -329,7 +329,7 @@ static njs_external_t  ngx_http_js_ext_r
   NULL,
   NULL,
   NULL,
-  offsetof(ngx_http_request_t, headers_out.status) },
+  0 },
 
 { njs_str("headersOut"),
   NJS_EXTERN_OBJECT,
diff -r de6c3c68e18e -r 71decc0d345c src/njs_object_prop.c
--- a/src/njs_object_prop.c Fri Nov 08 16:29:34 2019 +0300
+++ b/src/njs_object_prop.c Fri Nov 08 20:33:46 2019 +0300
@@ -585,9 +585,9 @@ static const njs_value_t  njs_object_val
 static const njs_value_t  njs_object_get_string = njs_string("get");
 static const njs_value_t  njs_object_set_string = njs_string("set");
 static const njs_value_t  njs_object_writable_string =
-   
njs_string("writable");
+njs_string("writable");
 static const njs_value_t  njs_object_enumerable_string =
-   
njs_string("enumerable");
+njs_string("enumerable");
 static const njs_value_t  njs_object_configurable_string =
 njs_string("configurable");
 
diff -r de6c3c68e18e -r 71decc0d345c src/njs_value.c
--- a/src/njs_value.c   Fri Nov 08 16:29:34 2019 +0300
+++ b/src/njs_value.c   Fri Nov 08 20:33:46 2019 +0300
@@ -120,7 +120,7 @@ njs_value_release(njs_vm_t *vm, njs_valu
 
 njs_int_t
 njs_value_to_primitive(njs_vm_t *vm, njs_value_t *dst, njs_value_t *value,
-   njs_uint_t hint)
+njs_uint_t hint)
 {
 njs_int_t   ret;
 njs_uint_t  tries;
___
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel


[njs] Style.

2019-10-04 Thread Dmitry Volyntsev
details:   https://hg.nginx.org/njs/rev/1cd7640472b8
branches:  
changeset: 1171:1cd7640472b8
user:  Dmitry Volyntsev 
date:  Fri Oct 04 19:46:12 2019 +0300
description:
Style.

Fixed typo in njs_arr_t structure.

This closes #226 issue on Github.

diffstat:

 src/njs_arr.c |  10 +-
 src/njs_arr.h |   2 +-
 2 files changed, 6 insertions(+), 6 deletions(-)

diffs (60 lines):

diff -r d62db2c99851 -r 1cd7640472b8 src/njs_arr.c
--- a/src/njs_arr.c Fri Oct 04 17:19:06 2019 +0300
+++ b/src/njs_arr.c Fri Oct 04 19:46:12 2019 +0300
@@ -21,7 +21,7 @@ njs_arr_create(njs_mp_t *mp, njs_uint_t 
 arr->start = (char *) arr + sizeof(njs_arr_t);
 arr->items = 0;
 arr->item_size = size;
-arr->avalaible = n;
+arr->available = n;
 arr->pointer = 1;
 arr->separate = 1;
 arr->mem_pool = mp;
@@ -37,7 +37,7 @@ njs_arr_init(njs_mp_t *mp, njs_arr_t *ar
 arr->start = start;
 arr->items = n;
 arr->item_size = size;
-arr->avalaible = n;
+arr->available = n;
 arr->pointer = 0;
 arr->separate = 0;
 arr->mem_pool = mp;
@@ -61,7 +61,7 @@ njs_arr_destroy(njs_arr_t *arr)
 #if (NJS_DEBUG)
 arr->start = NULL;
 arr->items = 0;
-arr->avalaible = 0;
+arr->available = 0;
 #endif
 }
 
@@ -84,7 +84,7 @@ njs_arr_add_multiple(njs_arr_t *arr, njs
 void  *item, *start, *old;
 uint32_t  n;
 
-n = arr->avalaible;
+n = arr->available;
 items += arr->items;
 
 if (items >= n) {
@@ -107,7 +107,7 @@ njs_arr_add_multiple(njs_arr_t *arr, njs
 return NULL;
 }
 
-arr->avalaible = n;
+arr->available = n;
 old = arr->start;
 arr->start = start;
 
diff -r d62db2c99851 -r 1cd7640472b8 src/njs_arr.h
--- a/src/njs_arr.h Fri Oct 04 17:19:06 2019 +0300
+++ b/src/njs_arr.h Fri Oct 04 19:46:12 2019 +0300
@@ -15,7 +15,7 @@ typedef struct {
  * The item size is no more than 64K.
  */
 uint16_t  items;
-uint16_t  avalaible;
+uint16_t  available;
 uint16_t  item_size;
 
 uint8_t   pointer;
___
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel


[njs] Style.

2019-09-06 Thread Dmitry Volyntsev
details:   https://hg.nginx.org/njs/rev/12da61ec4adb
branches:  
changeset: 1157:12da61ec4adb
user:  Dmitry Volyntsev 
date:  Fri Sep 06 15:47:12 2019 +0300
description:
Style.

diffstat:

 src/njs_dtoa.c   |  14 +++---
 src/njs_dtoa.h   |   2 +-
 src/njs_dtoa_fixed.c |   8 
 src/njs_shell.c  |   7 ---
 4 files changed, 16 insertions(+), 15 deletions(-)

diffs (131 lines):

diff -r d46a332c9c4d -r 12da61ec4adb src/njs_dtoa.c
--- a/src/njs_dtoa.cTue Sep 03 17:31:45 2019 +0300
+++ b/src/njs_dtoa.cFri Sep 06 15:47:12 2019 +0300
@@ -236,7 +236,7 @@ njs_grisu2(double value, char *start, in
 
 
 njs_inline size_t
-njs_write_exponent(int exp, char* start)
+njs_write_exponent(int exp, char *start)
 {
 char  *p;
 size_tlen;
@@ -297,7 +297,7 @@ njs_prettify(char *start, size_t len, in
 memmove([kk + 1], [kk], length - kk);
 start[kk] = '.';
 
-return (length + 1);
+return length + 1;
 
 } else if (-6 < kk && kk <= 0) {
 
@@ -313,7 +313,7 @@ njs_prettify(char *start, size_t len, in
 njs_memset([2], '0', offset - 2);
 }
 
-return (length + offset);
+return length + offset;
 
 } else if (length == 1) {
 
@@ -323,7 +323,7 @@ njs_prettify(char *start, size_t len, in
 
 size =  njs_write_exponent(kk - 1, [2]);
 
-return (size + 2);
+return size + 2;
 
 }
 
@@ -335,7 +335,7 @@ njs_prettify(char *start, size_t len, in
 
 size = njs_write_exponent(kk - 1, [length + 2]);
 
-return (size + length + 2);
+return size + length + 2;
 }
 
 
@@ -354,7 +354,7 @@ njs_dtoa(double value, char *start)
 if (value == 0) {
 *p++ = '0';
 
-return (p - start);
+return p - start;
 }
 
 if (signbit(value)) {
@@ -367,5 +367,5 @@ njs_dtoa(double value, char *start)
 
 length = njs_prettify(p, length, dec_exp);
 
-return (minus + length);
+return minus + length;
 }
diff -r d46a332c9c4d -r 12da61ec4adb src/njs_dtoa.h
--- a/src/njs_dtoa.hTue Sep 03 17:31:45 2019 +0300
+++ b/src/njs_dtoa.hFri Sep 06 15:47:12 2019 +0300
@@ -7,6 +7,6 @@
 #ifndef _NJS_DTOA_H_INCLUDED_
 #define _NJS_DTOA_H_INCLUDED_
 
-NJS_EXPORT size_t njs_dtoa(double value, char* buffer);
+NJS_EXPORT size_t njs_dtoa(double value, char *buffer);
 
 #endif /* _NJS_DTOA_H_INCLUDED_ */
diff -r d46a332c9c4d -r 12da61ec4adb src/njs_dtoa_fixed.c
--- a/src/njs_dtoa_fixed.c  Tue Sep 03 17:31:45 2019 +0300
+++ b/src/njs_dtoa_fixed.c  Fri Sep 06 15:47:12 2019 +0300
@@ -134,9 +134,9 @@ njs_diyu128_bit_at(njs_diyu128_t v, njs_
 static size_t
 njs_fill_digits32(uint32_t number, char *start, size_t length)
 {
-charc;
-size_t  i, j, n;
-njs_int_t   digit;
+char   c;
+size_t i, j, n;
+njs_int_t  digit;
 
 n = 0;
 
@@ -268,7 +268,7 @@ njs_fill_fractionals(uint64_t fractional
 njs_diyu128_t  fractionals128;
 
 /*
- * 128 <= exponent <= 0.
+ * -128 <= exponent <= 0.
  * 0 <= fractionals * 2^exponent < 1.
  */
 
diff -r d46a332c9c4d -r 12da61ec4adb src/njs_shell.c
--- a/src/njs_shell.c   Tue Sep 03 17:31:45 2019 +0300
+++ b/src/njs_shell.c   Fri Sep 06 15:47:12 2019 +0300
@@ -286,9 +286,9 @@ done:
 
 
 static njs_int_t
-njs_get_options(njs_opts_t *opts, int argc, char** argv)
+njs_get_options(njs_opts_t *opts, int argc, char **argv)
 {
-char *p, **paths;
+char   *p, **paths;
 njs_int_t  i, ret;
 
 static const char  help[] =
@@ -511,13 +511,14 @@ njs_process_file(njs_opts_t *opts, njs_v
 {
 int  fd;
 char *file;
-u_char   buf[4096], *p, *end, *start;
+u_char   *p, *end, *start;
 size_t   size;
 ssize_t  n;
 njs_vm_t *vm;
 njs_int_tret;
 njs_str_tsource, script;
 struct stat  sb;
+u_char   buf[4096];
 
 file = opts->file;
 
___
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel


[njs] Style.

2019-08-05 Thread Dmitry Volyntsev
details:   https://hg.nginx.org/njs/rev/1acb3acb1059
branches:  
changeset: 1106:1acb3acb1059
user:  hongzhidao 
date:  Sun Aug 04 11:17:48 2019 -0400
description:
Style.

Renaming arguments of the functions as follows:
1) "property" -> "key".
2) if function handles values of any type, its main argument
   is named "value".

diffstat:

 src/njs_object.h  |   2 +-
 src/njs_object_prop.c |   4 +-
 src/njs_value.c   |  72 +-
 src/njs_value.h   |   8 ++--
 src/njs_vmcode.c  |  47 -
 5 files changed, 66 insertions(+), 67 deletions(-)

diffs (468 lines):

diff -r bfdf58ec9116 -r 1acb3acb1059 src/njs_object.h
--- a/src/njs_object.h  Mon Aug 05 17:10:59 2019 +0300
+++ b/src/njs_object.h  Sun Aug 04 11:17:48 2019 -0400
@@ -61,7 +61,7 @@ njs_object_prop_t *njs_object_property(n
 njs_int_t njs_object_prop_define(njs_vm_t *vm, njs_value_t *object,
 njs_value_t *name, njs_value_t *value);
 njs_int_t njs_object_prop_descriptor(njs_vm_t *vm, njs_value_t *dest,
-njs_value_t *value, njs_value_t *property);
+njs_value_t *value, njs_value_t *setval);
 njs_int_t njs_prop_private_copy(njs_vm_t *vm, njs_property_query_t *pq);
 const char *njs_prop_type_string(njs_object_prop_type_t type);
 
diff -r bfdf58ec9116 -r 1acb3acb1059 src/njs_object_prop.c
--- a/src/njs_object_prop.c Mon Aug 05 17:10:59 2019 +0300
+++ b/src/njs_object_prop.c Sun Aug 04 11:17:48 2019 -0400
@@ -433,7 +433,7 @@ static const njs_value_t  njs_object_con
 
 njs_int_t
 njs_object_prop_descriptor(njs_vm_t *vm, njs_value_t *dest,
-njs_value_t *value, njs_value_t *property)
+njs_value_t *value, njs_value_t *key)
 {
 njs_int_t ret;
 njs_object_t  *desc;
@@ -444,7 +444,7 @@ njs_object_prop_descriptor(njs_vm_t *vm,
 
 njs_property_query_init(, NJS_PROPERTY_QUERY_GET, 1);
 
-ret = njs_property_query(vm, , value, property);
+ret = njs_property_query(vm, , value, key);
 
 switch (ret) {
 case NJS_OK:
diff -r bfdf58ec9116 -r 1acb3acb1059 src/njs_value.c
--- a/src/njs_value.c   Mon Aug 05 17:10:59 2019 +0300
+++ b/src/njs_value.c   Sun Aug 04 11:17:48 2019 -0400
@@ -10,7 +10,7 @@
 
 static njs_int_t njs_object_property_query(njs_vm_t *vm,
 njs_property_query_t *pq, njs_object_t *object,
-const njs_value_t *property);
+const njs_value_t *key);
 static njs_int_t njs_array_property_query(njs_vm_t *vm,
 njs_property_query_t *pq, njs_array_t *array, uint32_t index);
 static njs_int_t njs_string_property_query(njs_vm_t *vm,
@@ -487,8 +487,8 @@ njs_value_is_function(const njs_value_t 
  */
 
 njs_int_t
-njs_property_query(njs_vm_t *vm, njs_property_query_t *pq, njs_value_t *object,
-njs_value_t *property)
+njs_property_query(njs_vm_t *vm, njs_property_query_t *pq, njs_value_t *value,
+njs_value_t *key)
 {
 uint32_tindex;
 njs_int_t   ret;
@@ -496,29 +496,29 @@ njs_property_query(njs_vm_t *vm, njs_pro
 njs_value_t prop;
 njs_function_t  *function;
 
-if (njs_slow_path(!njs_is_primitive(property))) {
-ret = njs_value_to_string(vm, , property);
+if (njs_slow_path(!njs_is_primitive(key))) {
+ret = njs_value_to_string(vm, , key);
 if (ret != NJS_OK) {
 return ret;
 }
 
-property = 
+key = 
 }
 
-switch (object->type) {
+switch (value->type) {
 
 case NJS_BOOLEAN:
 case NJS_NUMBER:
-index = njs_primitive_prototype_index(object->type);
+index = njs_primitive_prototype_index(value->type);
 obj = >prototypes[index].object;
 break;
 
 case NJS_STRING:
-if (njs_fast_path(!njs_is_null_or_undefined_or_boolean(property))) {
-index = njs_value_to_index(property);
+if (njs_fast_path(!njs_is_null_or_undefined_or_boolean(key))) {
+index = njs_value_to_index(key);
 
 if (njs_fast_path(index < NJS_STRING_MAX_LENGTH)) {
-return njs_string_property_query(vm, pq, object, index);
+return njs_string_property_query(vm, pq, value, index);
 }
 }
 
@@ -541,11 +541,11 @@ njs_property_query(njs_vm_t *vm, njs_pro
 case NJS_OBJECT_TYPE_ERROR:
 case NJS_OBJECT_URI_ERROR:
 case NJS_OBJECT_VALUE:
-obj = njs_object(object);
+obj = njs_object(value);
 break;
 
 case NJS_FUNCTION:
-function = njs_function_value_copy(vm, object);
+function = njs_function_value_copy(vm, value);
 if (njs_slow_path(function == NULL)) {
 return NJS_ERROR;
 }
@@ -560,7 +560,7 @@ njs_property_query(njs_vm_t *vm, njs_pro
 case NJS_UNDEFINED:
 case NJS_NULL:
 default:
-ret = njs_primitive_value_to_string(vm, >value, property);
+ret = njs_primitive_value_to_string(vm, >value, key);
 
 if (njs_fast_path(ret == NJS_OK)) {
 njs_string_get(>value, >lhq.key);

[njs] Style.

2019-07-29 Thread Dmitry Volyntsev
details:   https://hg.nginx.org/njs/rev/57a50d1ad5cc
branches:  
changeset: 1083:57a50d1ad5cc
user:  hongzhidao 
date:  Fri Jul 26 23:01:38 2019 -0400
description:
Style.

diffstat:

 njs/njs_object_property.c |  2 +-
 njs/njs_vmcode.c  |  6 +++---
 njs/njs_vmcode.h  |  3 ++-
 3 files changed, 6 insertions(+), 5 deletions(-)

diffs (54 lines):

diff -r 19aec8a00867 -r 57a50d1ad5cc njs/njs_object_property.c
--- a/njs/njs_object_property.c Mon Jul 29 16:22:39 2019 +0300
+++ b/njs/njs_object_property.c Fri Jul 26 23:01:38 2019 -0400
@@ -322,7 +322,7 @@ njs_string_property_query(njs_vm_t *vm, 
 pq->lhq.value = prop;
 
 if (pq->query != NJS_PROPERTY_QUERY_GET) {
-/* pq->lhq.key is used by njs_vmcode_property_set for TypeError */
+/* pq->lhq.key is used by NJS_VMCODE_PROPERTY_SET for TypeError */
 njs_uint32_to_string(>value, index);
 njs_string_get(>value, >lhq.key);
 }
diff -r 19aec8a00867 -r 57a50d1ad5cc njs/njs_vmcode.c
--- a/njs/njs_vmcode.c  Mon Jul 29 16:22:39 2019 +0300
+++ b/njs/njs_vmcode.c  Fri Jul 26 23:01:38 2019 -0400
@@ -14,7 +14,7 @@ struct njs_property_next_s {
 njs_array_t  *array;
 };
 
-static njs_ret_t njs_vmcode_object(njs_vm_t *vm, u_char *pc);
+static njs_ret_t njs_vmcode_object(njs_vm_t *vm);
 static njs_ret_t njs_vmcode_array(njs_vm_t *vm, u_char *pc);
 static njs_ret_t njs_vmcode_function(njs_vm_t *vm, u_char *pc);
 static njs_ret_t njs_vmcode_arguments(njs_vm_t *vm, u_char *pc);
@@ -532,7 +532,7 @@ next:
 goto next;
 
 case NJS_VMCODE_OBJECT:
-ret = njs_vmcode_object(vm, pc);
+ret = njs_vmcode_object(vm);
 break;
 
 case NJS_VMCODE_ARRAY:
@@ -871,7 +871,7 @@ done:
 
 
 static njs_ret_t
-njs_vmcode_object(njs_vm_t *vm, u_char *pc)
+njs_vmcode_object(njs_vm_t *vm)
 {
 njs_object_t  *object;
 
diff -r 19aec8a00867 -r 57a50d1ad5cc njs/njs_vmcode.h
--- a/njs/njs_vmcode.h  Mon Jul 29 16:22:39 2019 +0300
+++ b/njs/njs_vmcode.h  Fri Jul 26 23:01:38 2019 -0400
@@ -374,6 +374,7 @@ typedef struct {
 } njs_vmcode_reference_error_t;
 
 
-nxt_int_t njs_vmcode_interpreter(njs_vm_t *vm, u_char *code);
+nxt_int_t njs_vmcode_interpreter(njs_vm_t *vm, u_char *pc);
+
 
 #endif /* _NJS_VMCODE_H_INCLUDED_ */
___
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel


[njs] Style in nxt_unicode_upper_case.pl and nxt_unicode_upper_case.h.

2019-07-26 Thread Valentin Bartenev
details:   https://hg.nginx.org/njs/rev/0af076f81e2b
branches:  
changeset: 1071:0af076f81e2b
user:  Valentin Bartenev 
date:  Sat Jul 27 03:51:48 2019 +0300
description:
Style in nxt_unicode_upper_case.pl and nxt_unicode_upper_case.h.

diffstat:

 nxt/nxt_unicode_upper_case.h  |  4 ++--
 nxt/nxt_unicode_upper_case.pl |  4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diffs (29 lines):

diff -r 6aa2e67eaafc -r 0af076f81e2b nxt/nxt_unicode_upper_case.h
--- a/nxt/nxt_unicode_upper_case.h  Fri Jul 26 20:37:13 2019 +0300
+++ b/nxt/nxt_unicode_upper_case.h  Sat Jul 27 03:51:48 2019 +0300
@@ -4,9 +4,9 @@
  * 16496 bytes on 32-bit platforms, 18576 bytes on 64-bit platforms.
  */
 
-#define NXT_UNICODE_MAX_UPPER_CASE   0x1044f
+#define NXT_UNICODE_MAX_UPPER_CASE  0x1044f
 
-#define NXT_UNICODE_BLOCK_SIZE   128
+#define NXT_UNICODE_BLOCK_SIZE  128
 
 
 static const uint32_t  nxt_unicode_upper_case_block_000[128]
diff -r 6aa2e67eaafc -r 0af076f81e2b nxt/nxt_unicode_upper_case.pl
--- a/nxt/nxt_unicode_upper_case.pl Fri Jul 26 20:37:13 2019 +0300
+++ b/nxt/nxt_unicode_upper_case.pl Sat Jul 27 03:51:48 2019 +0300
@@ -48,8 +48,8 @@ printf("\n/*\n" .
($blocks - 1) * BLOCK_SIZE * 4 + $last_block_size + $max_block * 4,
($blocks - 1) * BLOCK_SIZE * 4 + $last_block_size + $max_block * 8);
 
-printf("#define NXT_UNICODE_MAX_UPPER_CASE   0x%05x\n\n", $max_upper_case);
-printf("#define NXT_UNICODE_BLOCK_SIZE   %d\n\n\n", BLOCK_SIZE);
+printf("#define NXT_UNICODE_MAX_UPPER_CASE  0x%05x\n\n", $max_upper_case);
+printf("#define NXT_UNICODE_BLOCK_SIZE  %d\n\n\n", BLOCK_SIZE);
 
 
 for my $block (sort { $a <=> $b } keys %blocks) {
___
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel


[njs] Style.

2019-06-18 Thread Dmitry Volyntsev
details:   https://hg.nginx.org/njs/rev/c427fe5a4882
branches:  
changeset: 1010:c427fe5a4882
user:  Dmitry Volyntsev 
date:  Tue Jun 18 20:27:39 2019 +0300
description:
Style.

diffstat:

 njs/njs_object.c  |   20 
 njs/njs_object_property.c |  106 +++---
 2 files changed, 63 insertions(+), 63 deletions(-)

diffs (340 lines):

diff -r 4d21c3e3807f -r c427fe5a4882 njs/njs_object.c
--- a/njs/njs_object.c  Tue Jun 18 20:27:25 2019 +0300
+++ b/njs/njs_object.c  Tue Jun 18 20:27:39 2019 +0300
@@ -1114,7 +1114,7 @@ njs_object_define_property(njs_vm_t *vm,
 {
 nxt_int_t  ret;
 njs_value_t*value;
-const njs_value_t  *name, *descriptor;
+const njs_value_t  *name, *desc;
 
 if (!njs_is_object(njs_arg(args, nargs, 1))) {
 njs_type_error(vm, "cannot convert %s argument to object",
@@ -1129,16 +1129,16 @@ njs_object_define_property(njs_vm_t *vm,
 return NXT_ERROR;
 }
 
-descriptor = njs_arg(args, nargs, 3);
-
-if (!njs_is_object(descriptor)) {
+desc = njs_arg(args, nargs, 3);
+
+if (!njs_is_object(desc)) {
 njs_type_error(vm, "descriptor is not an object");
 return NXT_ERROR;
 }
 
 name = njs_arg(args, nargs, 2);
 
-ret = njs_object_prop_define(vm, value, name, descriptor);
+ret = njs_object_prop_define(vm, value, name, desc);
 if (nxt_slow_path(ret != NXT_OK)) {
 return NXT_ERROR;
 }
@@ -1158,7 +1158,7 @@ njs_object_define_properties(njs_vm_t *v
 nxt_lvlhsh_t   *hash;
 nxt_lvlhsh_each_t  lhe;
 njs_object_prop_t  *prop;
-const njs_value_t  *descriptor;
+const njs_value_t  *desc;
 
 if (!njs_is_object(njs_arg(args, nargs, 1))) {
 njs_type_error(vm, "cannot convert %s argument to object",
@@ -1173,16 +1173,16 @@ njs_object_define_properties(njs_vm_t *v
 return NXT_ERROR;
 }
 
-descriptor = njs_arg(args, nargs, 2);
-
-if (!njs_is_object(descriptor)) {
+desc = njs_arg(args, nargs, 2);
+
+if (!njs_is_object(desc)) {
 njs_type_error(vm, "descriptor is not an object");
 return NXT_ERROR;
 }
 
 nxt_lvlhsh_each_init(, _object_hash_proto);
 
-hash = >data.u.object->hash;
+hash = >data.u.object->hash;
 
 for ( ;; ) {
 prop = nxt_lvlhsh_each(hash, );
diff -r 4d21c3e3807f -r c427fe5a4882 njs/njs_object_property.c
--- a/njs/njs_object_property.c Tue Jun 18 20:27:25 2019 +0300
+++ b/njs/njs_object_property.c Tue Jun 18 20:27:39 2019 +0300
@@ -752,7 +752,7 @@ njs_object_prop_define(njs_vm_t *vm, njs
 const njs_value_t *name, const njs_value_t *value)
 {
 nxt_int_t ret;
-njs_object_prop_t *desc, *current;
+njs_object_prop_t *prop, *prev;
 njs_property_query_t  pq;
 
 njs_string_get(name, );
@@ -767,39 +767,39 @@ njs_object_prop_define(njs_vm_t *vm, njs
 return ret;
 }
 
-desc = njs_descriptor_prop(vm, name, value->data.u.object);
-if (nxt_slow_path(desc == NULL)) {
+prop = njs_descriptor_prop(vm, name, value->data.u.object);
+if (nxt_slow_path(prop == NULL)) {
 return NXT_ERROR;
 }
 
 if (nxt_fast_path(ret == NXT_DECLINED)) {
 
-if (!njs_is_valid(>value)) {
-desc->value = njs_value_undefined;
+if (!njs_is_valid(>value)) {
+prop->value = njs_value_undefined;
 }
 
-if (desc->writable == NJS_ATTRIBUTE_UNSET) {
-desc->writable = 0;
+if (prop->writable == NJS_ATTRIBUTE_UNSET) {
+prop->writable = 0;
 }
 
-if (desc->enumerable == NJS_ATTRIBUTE_UNSET) {
-desc->enumerable = 0;
+if (prop->enumerable == NJS_ATTRIBUTE_UNSET) {
+prop->enumerable = 0;
 }
 
-if (desc->configurable == NJS_ATTRIBUTE_UNSET) {
-desc->configurable = 0;
+if (prop->configurable == NJS_ATTRIBUTE_UNSET) {
+prop->configurable = 0;
 }
 
 if (nxt_slow_path(pq.lhq.value != NULL)) {
-current = pq.lhq.value;
+prev = pq.lhq.value;
 
-if (nxt_slow_path(current->type == NJS_WHITEOUT)) {
+if (nxt_slow_path(prev->type == NJS_WHITEOUT)) {
 /* Previously deleted property.  */
-*current = *desc;
+*prev = *prop;
 }
 
 } else {
-pq.lhq.value = desc;
+pq.lhq.value = prop;
 pq.lhq.replace = 0;
 pq.lhq.pool = vm->mem_pool;
 
@@ -823,25 +823,25 @@ njs_object_prop_define(njs_vm_t *vm, njs
 }
 }
 
-current = pq.lhq.value;
+prev = pq.lhq.value;
 
-switch (current->type) {
+switch (prev->type) {
 case NJS_PROPERTY:
 case NJS_METHOD:
 break;
 
 case NJS_PROPERTY_REF:
-if (njs_is_valid(>value)) {
-*current->value.data.u.value = desc->value;
+if (njs_is_valid(>value)) {
+

[njs] Style.

2019-06-11 Thread Dmitry Volyntsev
details:   https://hg.nginx.org/njs/rev/c46dca06edb1
branches:  
changeset: 1003:c46dca06edb1
user:  hongzhidao 
date:  Mon Jun 10 21:40:11 2019 -0400
description:
Style.

diffstat:

 njs/njs_object.c  |   8 
 njs/njs_object.h  |  10 +-
 njs/njs_object_property.c |   8 
 3 files changed, 13 insertions(+), 13 deletions(-)

diffs (108 lines):

diff -r 81ae2f4a1686 -r c46dca06edb1 njs/njs_object.c
--- a/njs/njs_object.c  Mon Jun 10 21:30:29 2019 -0400
+++ b/njs/njs_object.c  Mon Jun 10 21:40:11 2019 -0400
@@ -1142,7 +1142,7 @@ njs_object_define_property(njs_vm_t *vm,
 
 name = njs_arg(args, nargs, 2);
 
-ret = njs_define_property(vm, value, name, descriptor->data.u.object);
+ret = njs_object_prop_define(vm, value, name, descriptor->data.u.object);
 if (nxt_slow_path(ret != NXT_OK)) {
 return NXT_ERROR;
 }
@@ -1196,7 +1196,7 @@ njs_object_define_properties(njs_vm_t *v
 }
 
 if (prop->enumerable && njs_is_object(>value)) {
-ret = njs_define_property(vm, value, >name,
+ret = njs_object_prop_define(vm, value, >name,
   prop->value.data.u.object);
 
 if (nxt_slow_path(ret != NXT_OK)) {
@@ -1227,7 +1227,7 @@ njs_object_get_own_property_descriptor(n
 
 property = njs_arg(args, nargs, 2);
 
-return njs_object_property_descriptor(vm, >retval, value, property);
+return njs_object_prop_descriptor(vm, >retval, value, property);
 }
 
 
@@ -1271,7 +1271,7 @@ njs_object_get_own_property_descriptors(
 
 for (i = 0; i < length; i++) {
 key = >start[i];
-ret = njs_object_property_descriptor(vm, , value, key);
+ret = njs_object_prop_descriptor(vm, , value, key);
 if (nxt_slow_path(ret != NXT_OK)) {
 return ret;
 }
diff -r 81ae2f4a1686 -r c46dca06edb1 njs/njs_object.h
--- a/njs/njs_object.h  Mon Jun 10 21:30:29 2019 -0400
+++ b/njs/njs_object.h  Mon Jun 10 21:40:11 2019 -0400
@@ -14,7 +14,7 @@ typedef enum {
 NJS_METHOD,
 NJS_PROPERTY_HANDLER,
 NJS_WHITEOUT,
-} njs_object_property_type_t;
+} njs_object_prop_type_t;
 
 
 /*
@@ -33,7 +33,7 @@ typedef struct {
 njs_value_t value;
 njs_value_t name;
 
-njs_object_property_type_t  type:8;  /* 3 bits */
+njs_object_prop_type_t  type:8;  /* 3 bits */
 
 njs_object_attribute_t  writable:8;  /* 2 bits */
 njs_object_attribute_t  enumerable:8;/* 2 bits */
@@ -116,12 +116,12 @@ njs_object_prop_t *njs_object_prop_alloc
 const njs_value_t *value, uint8_t attributes);
 njs_object_prop_t *njs_object_property(njs_vm_t *vm, const njs_object_t *obj,
 nxt_lvlhsh_query_t *lhq);
-njs_ret_t njs_define_property(njs_vm_t *vm, njs_value_t *object,
+njs_ret_t njs_object_prop_define(njs_vm_t *vm, njs_value_t *object,
 const njs_value_t *name, const njs_object_t *descriptor);
-njs_ret_t njs_object_property_descriptor(njs_vm_t *vm, njs_value_t *dest,
+njs_ret_t njs_object_prop_descriptor(njs_vm_t *vm, njs_value_t *dest,
 const njs_value_t *value, const njs_value_t *property);
 njs_ret_t njs_prop_private_copy(njs_vm_t *vm, njs_property_query_t *pq);
-const char *njs_prop_type_string(njs_object_property_type_t type);
+const char *njs_prop_type_string(njs_object_prop_type_t type);
 
 extern const njs_object_init_t  njs_object_constructor_init;
 extern const njs_object_init_t  njs_object_prototype_init;
diff -r 81ae2f4a1686 -r c46dca06edb1 njs/njs_object_property.c
--- a/njs/njs_object_property.c Mon Jun 10 21:30:29 2019 -0400
+++ b/njs/njs_object_property.c Mon Jun 10 21:40:11 2019 -0400
@@ -748,8 +748,8 @@ njs_object_property(njs_vm_t *vm, const 
  *   (values can be set, but without property flags support).
  */
 njs_ret_t
-njs_define_property(njs_vm_t *vm, njs_value_t *object, const njs_value_t *name,
-const njs_object_t *descriptor)
+njs_object_prop_define(njs_vm_t *vm, njs_value_t *object,
+const njs_value_t *name, const njs_object_t *descriptor)
 {
 nxt_int_t ret;
 njs_object_prop_t *desc, *current;
@@ -970,7 +970,7 @@ static const njs_value_t  njs_object_con
 
 
 njs_ret_t
-njs_object_property_descriptor(njs_vm_t *vm, njs_value_t *dest,
+njs_object_prop_descriptor(njs_vm_t *vm, njs_value_t *dest,
 const njs_value_t *value, const njs_value_t *property)
 {
 nxt_int_t ret;
@@ -1192,7 +1192,7 @@ njs_prop_private_copy(njs_vm_t *vm, njs_
 
 
 const char *
-njs_prop_type_string(njs_object_property_type_t type)
+njs_prop_type_string(njs_object_prop_type_t type)
 {
 switch (type) {
 case NJS_PROPERTY_REF:
___
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel


[njs] Style.

2019-05-20 Thread Dmitry Volyntsev
details:   https://hg.nginx.org/njs/rev/283813f5840f
branches:  
changeset: 972:283813f5840f
user:  hongzhidao 
date:  Mon May 20 16:05:58 2019 +0800
description:
Style.

diffstat:

 njs/njs_builtin.c |  17 +
 njs/njs_builtin.h |   1 +
 njs/njs_parser_terminal.c |   2 +-
 njs/njs_vm.h  |   1 +
 4 files changed, 12 insertions(+), 9 deletions(-)

diffs (89 lines):

diff -r 14ec3b2096af -r 283813f5840f njs/njs_builtin.c
--- a/njs/njs_builtin.c Mon May 20 23:14:29 2019 +0800
+++ b/njs/njs_builtin.c Mon May 20 16:05:58 2019 +0800
@@ -30,11 +30,11 @@ static nxt_array_t *njs_vm_expression_co
 static nxt_array_t *njs_object_completions(njs_vm_t *vm, njs_object_t *object);
 
 
-const njs_object_init_t njs_njs_object_init;
-const njs_object_init_t njs_global_this_init;
+const njs_object_init_t  njs_njs_object_init;
+const njs_object_init_t  njs_global_this_init;
 
 
-const njs_object_init_t*njs_object_init[] = {
+const njs_object_init_t  *njs_object_init[] = {
 _global_this_init,/* global this*/
 _njs_object_init, /* global njs object  */
 _math_object_init,/* Math   */
@@ -43,9 +43,9 @@ const njs_object_init_t*njs_object_i
 };
 
 
-const njs_object_init_t*njs_module_init[] = {
-_fs_object_init, /* fs */
-_crypto_object_init, /* crypto */
+const njs_object_init_t  *njs_module_init[] = {
+_fs_object_init,  /* fs */
+_crypto_object_init,  /* crypto */
 NULL
 };
 
@@ -73,7 +73,7 @@ const njs_object_init_t  *njs_prototype_
 };
 
 
-const njs_object_init_t*njs_constructor_init[] = {
+const njs_object_init_t  *njs_constructor_init[] = {
 _object_constructor_init,
 _array_constructor_init,
 _boolean_constructor_init,
@@ -97,7 +97,7 @@ const njs_object_init_t*njs_construc
 };
 
 
-const njs_object_init_t*njs_function_init[] = {
+const njs_object_init_t  *njs_function_init[] = {
 _eval_function_init,
 _to_string_function_init,
 _is_nan_function_init,
@@ -165,6 +165,7 @@ const njs_function_init_t  njs_native_co
 { njs_memory_error_constructor,  { NJS_SKIP_ARG, NJS_STRING_ARG } },
 };
 
+
 const njs_object_prototype_t  njs_prototype_values[] = {
 /*
  * GCC 4 complains about uninitialized .shared field,
diff -r 14ec3b2096af -r 283813f5840f njs/njs_builtin.h
--- a/njs/njs_builtin.h Mon May 20 23:14:29 2019 +0800
+++ b/njs/njs_builtin.h Mon May 20 16:05:58 2019 +0800
@@ -13,4 +13,5 @@ extern const njs_object_init_t  *njs_mod
 extern const njs_object_init_t  *njs_prototype_init[];
 extern const njs_object_init_t  *njs_constructor_init[];
 
+
 #endif /* _NJS_BUILTIN_H_INCLUDED_ */
diff -r 14ec3b2096af -r 283813f5840f njs/njs_parser_terminal.c
--- a/njs/njs_parser_terminal.c Mon May 20 23:14:29 2019 +0800
+++ b/njs/njs_parser_terminal.c Mon May 20 16:05:58 2019 +0800
@@ -805,7 +805,7 @@ njs_parser_template_expression(njs_vm_t 
 
 if (token != NJS_TOKEN_CLOSE_BRACE) {
 njs_parser_syntax_error(vm, parser,
-"Missing \"}\" in template expression");
+"Missing \"}\" in template expression");
 return NXT_ERROR;
 }
 
diff -r 14ec3b2096af -r 283813f5840f njs/njs_vm.h
--- a/njs/njs_vm.h  Mon May 20 23:14:29 2019 +0800
+++ b/njs/njs_vm.h  Mon May 20 16:05:58 2019 +0800
@@ -894,6 +894,7 @@ typedef enum {
 #define njs_is_callee_argument_index(index)   \
 (((index) & NJS_SCOPE_CALLEE_ARGUMENTS) == NJS_SCOPE_CALLEE_ARGUMENTS)
 
+
 enum njs_prototypes_e {
 NJS_PROTOTYPE_OBJECT = 0,
 NJS_PROTOTYPE_ARRAY,
___
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel


[njs] Style.

2019-05-04 Thread Valentin Bartenev
details:   https://hg.nginx.org/njs/rev/b7cdfafdc20b
branches:  
changeset: 944:b7cdfafdc20b
user:  Valentin Bartenev 
date:  Sat May 04 16:59:24 2019 +0300
description:
Style.

diffstat:

 njs/njs_disassembler.c   |   2 --
 njs/njs_function.c   |   1 -
 njs/njs_json.c   |   8 
 njs/njs_object.c |  10 +-
 njs/njs_parser.c |   7 +++
 njs/njs_string.c |   1 -
 njs/test/njs_unit_test.c |  10 +-
 7 files changed, 17 insertions(+), 22 deletions(-)

diffs (123 lines):

diff -r 551d173ab9ec -r b7cdfafdc20b njs/njs_disassembler.c
--- a/njs/njs_disassembler.cSat May 04 05:52:15 2019 +0300
+++ b/njs/njs_disassembler.cSat May 04 16:59:24 2019 +0300
@@ -295,7 +295,6 @@ njs_disassemble(u_char *start, u_char *e
(size_t) method->method, method->nargs,
method->code.ctor ? " CTOR" : "");
 
-
 p += sizeof(njs_vmcode_method_frame_t);
 continue;
 }
@@ -308,7 +307,6 @@ njs_disassemble(u_char *start, u_char *e
(size_t) prop_foreach->object,
(size_t) prop_foreach->offset);
 
-
 p += sizeof(njs_vmcode_prop_foreach_t);
 continue;
 }
diff -r 551d173ab9ec -r b7cdfafdc20b njs/njs_function.c
--- a/njs/njs_function.cSat May 04 05:52:15 2019 +0300
+++ b/njs/njs_function.cSat May 04 16:59:24 2019 +0300
@@ -31,7 +31,6 @@ njs_function_alloc(njs_vm_t *vm, njs_fun
 goto fail;
 }
 
-
 /*
  * nxt_mp_zalloc() does also:
  *   nxt_lvlhsh_init(>object.hash);
diff -r 551d173ab9ec -r b7cdfafdc20b njs/njs_json.c
--- a/njs/njs_json.cSat May 04 05:52:15 2019 +0300
+++ b/njs/njs_json.cSat May 04 16:59:24 2019 +0300
@@ -1916,10 +1916,10 @@ njs_json_append_number(njs_json_stringif
 static njs_value_t *
 njs_json_wrap_value(njs_vm_t *vm, const njs_value_t *value)
 {
-nxt_int_t ret;
-njs_value_t   *wrapper;
-njs_object_prop_t *prop;
-nxt_lvlhsh_query_tlhq;
+nxt_int_t   ret;
+njs_value_t *wrapper;
+njs_object_prop_t   *prop;
+nxt_lvlhsh_query_t  lhq;
 
 wrapper = nxt_mp_alloc(vm->mem_pool, sizeof(njs_value_t));
 if (nxt_slow_path(wrapper == NULL)) {
diff -r 551d173ab9ec -r b7cdfafdc20b njs/njs_object.c
--- a/njs/njs_object.c  Sat May 04 05:52:15 2019 +0300
+++ b/njs/njs_object.c  Sat May 04 16:59:24 2019 +0300
@@ -2619,11 +2619,11 @@ njs_value_t *
 njs_property_prototype_create(njs_vm_t *vm, nxt_lvlhsh_t *hash,
 njs_object_t *prototype)
 {
-nxt_int_t  ret;
-njs_object_prop_t  *prop;
-nxt_lvlhsh_query_t lhq;
-
-static const njs_value_t   proto_string = njs_string("prototype");
+nxt_int_t ret;
+njs_object_prop_t *prop;
+nxt_lvlhsh_query_tlhq;
+
+static const njs_value_t  proto_string = njs_string("prototype");
 
 prop = njs_object_prop_alloc(vm, _string, _value_undefined, 0);
 if (nxt_slow_path(prop == NULL)) {
diff -r 551d173ab9ec -r b7cdfafdc20b njs/njs_parser.c
--- a/njs/njs_parser.c  Sat May 04 05:52:15 2019 +0300
+++ b/njs/njs_parser.c  Sat May 04 16:59:24 2019 +0300
@@ -1064,7 +1064,6 @@ njs_parser_var_statement(njs_vm_t *vm, n
 return NJS_TOKEN_ILLEGAL;
 }
 
-
 name = njs_parser_variable_node(vm, parser,
 njs_parser_text(parser),
 njs_parser_key_hash(parser),
@@ -2179,9 +2178,9 @@ njs_token_t
 njs_parser_arrow_expression(njs_vm_t *vm, njs_parser_t *parser,
 njs_token_t token)
 {
-njs_ret_t   ret;
-njs_index_t index;
-njs_parser_node_t   *node, *body, *parent;
+njs_ret_t  ret;
+njs_index_tindex;
+njs_parser_node_t  *node, *body, *parent;
 njs_function_lambda_t  *lambda;
 
 node = njs_parser_node_new(vm, parser, NJS_TOKEN_FUNCTION_EXPRESSION);
diff -r 551d173ab9ec -r b7cdfafdc20b njs/njs_string.c
--- a/njs/njs_string.c  Sat May 04 05:52:15 2019 +0300
+++ b/njs/njs_string.c  Sat May 04 16:59:24 2019 +0300
@@ -598,7 +598,6 @@ static const njs_object_prop_t  njs_stri
  NJS_SKIP_ARG, NJS_STRING_ARG),
 },
 
-
 /* String.fromCharCode(). */
 {
 .type = NJS_METHOD,
diff -r 551d173ab9ec -r b7cdfafdc20b njs/test/njs_unit_test.c
--- a/njs/test/njs_unit_test.c  Sat May 04 05:52:15 2019 +0300
+++ b/njs/test/njs_unit_test.c  Sat May 04 16:59:24 2019 +0300
@@ -13104,11 +13104,11 @@ done:
 static nxt_int_t
 njs_timezone_optional_test(nxt_bool_t disassemble, nxt_bool_t verbose)
 {
-size_t  size;
-u_char  buf[16];
-time_t  clock;
-struct tm   tm;
-nxt_int_t   ret;
+size_t size;
+u_char buf[16];
+time_t clock;
+struct tm  tm;
+nxt_int_t  ret;
 
 /*
  * Chatham Islands NZ-CHAT 

[njs] Style.

2019-04-18 Thread Dmitry Volyntsev
details:   https://hg.nginx.org/njs/rev/6d7a4fb82b25
branches:  
changeset: 910:6d7a4fb82b25
user:  Dmitry Volyntsev 
date:  Thu Apr 18 20:51:53 2019 +0300
description:
Style.

diffstat:

 njs/njs_generator.c |   4 +-
 njs/njs_object.c|  35 +++
 njs/njs_vm.c|  86 
 njs/test/module/lib1.js |   4 +-
 nxt/nxt_clang.h |   1 -
 5 files changed, 68 insertions(+), 62 deletions(-)

diffs (263 lines):

diff -r ec44a042cf15 -r 6d7a4fb82b25 njs/njs_generator.c
--- a/njs/njs_generator.c   Fri Apr 19 00:28:31 2019 +0800
+++ b/njs/njs_generator.c   Thu Apr 18 20:51:53 2019 +0300
@@ -1606,7 +1606,8 @@ njs_generate_stop_statement(njs_vm_t *vm
 }
 
 if (index == NJS_INDEX_NONE) {
-index = njs_value_index(vm, _value_undefined, 
generator->runtime);
+index = njs_value_index(vm, _value_undefined,
+generator->runtime);
 }
 
 stop->retval = index;
@@ -2548,6 +2549,7 @@ njs_generate_function_call(njs_vm_t *vm,
 if (nxt_slow_path(ret != NXT_OK)) {
 return ret;
 }
+
 name = node;
 }
 
diff -r ec44a042cf15 -r 6d7a4fb82b25 njs/njs_object.c
--- a/njs/njs_object.c  Fri Apr 19 00:28:31 2019 +0800
+++ b/njs/njs_object.c  Thu Apr 18 20:51:53 2019 +0300
@@ -27,7 +27,7 @@ static njs_ret_t njs_object_query_prop_h
 static njs_ret_t njs_define_property(njs_vm_t *vm, njs_value_t *object,
 const njs_value_t *name, const njs_object_t *descriptor);
 
-static njs_object_prop_t * njs_object_exist_in_proto(const njs_object_t *begin,
+static njs_object_prop_t *njs_object_exist_in_proto(const njs_object_t *begin,
 const njs_object_t *end, nxt_lvlhsh_query_t *lhq);
 static uint32_t njs_object_enumerate_array_length(const njs_object_t *object);
 static uint32_t njs_object_enumerate_string_length(const njs_object_t *object);
@@ -977,7 +977,7 @@ njs_object_entries(njs_vm_t *vm, njs_val
 
 
 static njs_object_prop_t *
-njs_object_exist_in_proto(const njs_object_t *begin, const njs_object_t *end,
+njs_object_exist_in_proto(const njs_object_t *object, const njs_object_t *end,
 nxt_lvlhsh_query_t *lhq)
 {
 nxt_int_t  ret;
@@ -985,8 +985,8 @@ njs_object_exist_in_proto(const njs_obje
 
 lhq->proto = _object_hash_proto;
 
-while (begin != end) {
-ret = nxt_lvlhsh_find(>hash, lhq);
+while (object != end) {
+ret = nxt_lvlhsh_find(>hash, lhq);
 
 if (nxt_fast_path(ret == NXT_OK)) {
 prop = lhq->value;
@@ -998,7 +998,7 @@ njs_object_exist_in_proto(const njs_obje
 return lhq->value;
 }
 
-ret = nxt_lvlhsh_find(>shared_hash, lhq);
+ret = nxt_lvlhsh_find(>shared_hash, lhq);
 
 if (nxt_fast_path(ret == NXT_OK)) {
 return lhq->value;
@@ -1006,7 +1006,7 @@ njs_object_exist_in_proto(const njs_obje
 
 next:
 
-begin = begin->__proto__;
+object = object->__proto__;
 }
 
 return NULL;
@@ -,7 +,7 @@ njs_object_own_enumerate_value(njs_vm_t 
 switch (object->type) {
 case NJS_ARRAY:
 ret = njs_object_enumerate_array(vm, (njs_array_t *) object, items,
-kind);
+ kind);
 break;
 
 case NJS_OBJECT_STRING:
@@ -1225,13 +1225,15 @@ static uint32_t
 njs_object_enumerate_object_length(const njs_object_t *object, nxt_bool_t all)
 {
 uint32_tlength;
-const njs_object_t  *ptr;
+const njs_object_t  *proto;
 
 length = njs_object_own_enumerate_object_length(object, object, all);
 
-for (ptr = object->__proto__; ptr != NULL; ptr = ptr->__proto__) {
-
-length += njs_object_own_enumerate_length(ptr, object, all);
+proto = object->__proto__;
+
+while (proto != NULL) {
+length += njs_object_own_enumerate_length(proto, object, all);
+proto = proto->__proto__;
 }
 
 return length;
@@ -1493,20 +1495,23 @@ njs_object_enumerate_object(njs_vm_t *vm
 njs_array_t *items, njs_object_enum_t kind, nxt_bool_t all)
 {
 njs_ret_t   ret;
-const njs_object_t  *ptr;
+const njs_object_t  *proto;
 
 ret = njs_object_own_enumerate_object(vm, object, object, items, kind, 
all);
 if (nxt_slow_path(ret != NXT_OK)) {
 return NXT_ERROR;
 }
 
-for (ptr = object->__proto__; ptr != NULL; ptr = ptr->__proto__) {
-
-ret = njs_object_own_enumerate_value(vm, ptr, object, items, kind,
+proto = object->__proto__;
+
+while (proto != NULL) {
+ret = njs_object_own_enumerate_value(vm, proto, object, items, kind,
  all);
 if (nxt_slow_path(ret != NXT_OK)) {
 return NXT_ERROR;
 }
+
+proto = proto->__proto__;
 }
 
 return NJS_OK;
diff -r ec44a042cf15 -r 6d7a4fb82b25 njs/njs_vm.c
--- a/njs/njs_vm.c  

[njs] Style.

2019-03-17 Thread Dmitry Volyntsev
details:   https://hg.nginx.org/njs/rev/9a87bf103c47
branches:  
changeset: 831:9a87bf103c47
user:  hongzhidao 
date:  Sun Mar 17 21:22:30 2019 +0800
description:
Style.

diffstat:

 njs/njs_generator.c |  4 ++--
 njs/njs_lexer.c |  2 +-
 njs/njs_parser.c|  6 +++---
 njs/njs_parser_expression.c |  2 +-
 4 files changed, 7 insertions(+), 7 deletions(-)

diffs (75 lines):

diff -r 65109fd228e0 -r 9a87bf103c47 njs/njs_generator.c
--- a/njs/njs_generator.c   Sun Mar 17 17:36:17 2019 +0300
+++ b/njs/njs_generator.c   Sun Mar 17 21:22:30 2019 +0800
@@ -2431,7 +2431,7 @@ njs_generate_argument_closures(njs_vm_t 
 n--;
 }
 
-} while(n != 0);
+} while (n != 0);
 
 return NXT_OK;
 }
@@ -2611,7 +2611,7 @@ njs_generate_method_call(njs_vm_t *vm, n
 
 static nxt_noinline nxt_int_t
 njs_generate_call(njs_vm_t *vm, njs_generator_t *generator,
-  njs_parser_node_t *node)
+njs_parser_node_t *node)
 {
 nxt_int_t   ret;
 nxt_uint_t  nargs;
diff -r 65109fd228e0 -r 9a87bf103c47 njs/njs_lexer.c
--- a/njs/njs_lexer.c   Sun Mar 17 17:36:17 2019 +0300
+++ b/njs/njs_lexer.c   Sun Mar 17 21:22:30 2019 +0800
@@ -404,7 +404,7 @@ njs_lexer_token_name_resolve(njs_lexer_t
 
 if (lexer->property) {
 lexer->property_token = lt->token;
-return NJS_TOKEN_NAME;
+lt->token = NJS_TOKEN_NAME;
 }
 }
 
diff -r 65109fd228e0 -r 9a87bf103c47 njs/njs_parser.c
--- a/njs/njs_parser.c  Sun Mar 17 17:36:17 2019 +0300
+++ b/njs/njs_parser.c  Sun Mar 17 21:22:30 2019 +0800
@@ -639,7 +639,7 @@ njs_parser_function_declaration(njs_vm_t
 }
 
 if (token != NJS_TOKEN_NAME) {
-if (token == NJS_TOKEN_ARGUMENTS || token ==  NJS_TOKEN_EVAL) {
+if (token == NJS_TOKEN_ARGUMENTS || token == NJS_TOKEN_EVAL) {
 njs_parser_syntax_error(vm, parser, "Identifier \"%V\" "
 "is forbidden in function declaration",
 njs_parser_text(parser));
@@ -1023,7 +1023,7 @@ njs_parser_var_statement(njs_vm_t *vm, n
 }
 
 if (token != NJS_TOKEN_NAME) {
-if (token == NJS_TOKEN_ARGUMENTS || token ==  NJS_TOKEN_EVAL) {
+if (token == NJS_TOKEN_ARGUMENTS || token == NJS_TOKEN_EVAL) {
 njs_parser_syntax_error(vm, parser, "Identifier \"%V\" "
 "is forbidden in var declaration",
 njs_parser_text(parser));
@@ -1475,7 +1475,7 @@ njs_parser_for_var_statement(njs_vm_t *v
 }
 
 if (token != NJS_TOKEN_NAME) {
-if (token == NJS_TOKEN_ARGUMENTS || token ==  NJS_TOKEN_EVAL) {
+if (token == NJS_TOKEN_ARGUMENTS || token == NJS_TOKEN_EVAL) {
 njs_parser_syntax_error(vm, parser, "Identifier \"%V\" "
"is forbidden in for-in var 
declaration",
njs_parser_text(parser));
diff -r 65109fd228e0 -r 9a87bf103c47 njs/njs_parser_expression.c
--- a/njs/njs_parser_expression.c   Sun Mar 17 17:36:17 2019 +0300
+++ b/njs/njs_parser_expression.c   Sun Mar 17 21:22:30 2019 +0800
@@ -354,7 +354,7 @@ njs_parser_assignment_expression(njs_vm_
 if (!njs_parser_is_lvalue(parser->node)) {
 token = parser->node->token;
 
-if (token == NJS_TOKEN_ARGUMENTS || token ==  NJS_TOKEN_EVAL) {
+if (token == NJS_TOKEN_ARGUMENTS || token == NJS_TOKEN_EVAL) {
 njs_parser_syntax_error(vm, parser, "Identifier \"%s\" "
   "is forbidden as left-hand in 
assignment",
(token == NJS_TOKEN_EVAL) ? "eval"
___
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel


[njs] Style.

2019-02-27 Thread Dmitry Volyntsev
details:   https://hg.nginx.org/njs/rev/984b7794c5f2
branches:  
changeset: 809:984b7794c5f2
user:  hongzhidao 
date:  Wed Feb 27 17:49:03 2019 +0800
description:
Style.

diffstat:

 njs/njs_lexer_keyword.c |  4 ++--
 njs/njs_parser.h|  2 +-
 njs/njs_variable.c  |  4 ++--
 3 files changed, 5 insertions(+), 5 deletions(-)

diffs (54 lines):

diff -r 7345fd14d1b4 -r 984b7794c5f2 njs/njs_lexer_keyword.c
--- a/njs/njs_lexer_keyword.c   Tue Feb 26 17:30:02 2019 +0800
+++ b/njs/njs_lexer_keyword.c   Wed Feb 27 17:49:03 2019 +0800
@@ -142,7 +142,7 @@ const nxt_lvlhsh_proto_t  njs_keyword_ha
 
 
 nxt_int_t
-njs_lexer_keywords_init(nxt_mp_t *mcp, nxt_lvlhsh_t *hash)
+njs_lexer_keywords_init(nxt_mp_t *mp, nxt_lvlhsh_t *hash)
 {
 nxt_uint_t   n;
 nxt_lvlhsh_query_t   lhq;
@@ -153,7 +153,7 @@ njs_lexer_keywords_init(nxt_mp_t *mcp, n
 
 lhq.replace = 0;
 lhq.proto = _keyword_hash_proto;
-lhq.pool = mcp;
+lhq.pool = mp;
 
 do {
 lhq.key_hash = nxt_djb_hash(keyword->name.start, keyword->name.length);
diff -r 7345fd14d1b4 -r 984b7794c5f2 njs/njs_parser.h
--- a/njs/njs_parser.h  Tue Feb 26 17:30:02 2019 +0800
+++ b/njs/njs_parser.h  Wed Feb 27 17:49:03 2019 +0800
@@ -310,7 +310,7 @@ typedef struct {
 njs_token_t njs_lexer_token(njs_lexer_t *lexer);
 void njs_lexer_rollback(njs_lexer_t *lexer);
 njs_token_t njs_lexer_peek_token(njs_lexer_t *lexer);
-nxt_int_t njs_lexer_keywords_init(nxt_mp_t *mcp, nxt_lvlhsh_t *hash);
+nxt_int_t njs_lexer_keywords_init(nxt_mp_t *mp, nxt_lvlhsh_t *hash);
 njs_token_t njs_lexer_keyword(njs_lexer_t *lexer);
 
 nxt_int_t njs_parser(njs_vm_t *vm, njs_parser_t *parser,
diff -r 7345fd14d1b4 -r 984b7794c5f2 njs/njs_variable.c
--- a/njs/njs_variable.cTue Feb 26 17:30:02 2019 +0800
+++ b/njs/njs_variable.cWed Feb 27 17:49:03 2019 +0800
@@ -175,7 +175,7 @@ njs_reference_hash_test(nxt_lvlhsh_query
 }
 
 
-const nxt_lvlhsh_proto_t  njs_reference_hash_proto
+const nxt_lvlhsh_proto_t  njs_references_hash_proto
 nxt_aligned(64) =
 {
 NXT_LVLHSH_DEFAULT,
@@ -205,7 +205,7 @@ njs_variable_reference(njs_vm_t *vm, njs
 
 lhq.key_hash = hash;
 lhq.key = vr->name;
-lhq.proto = _reference_hash_proto;
+lhq.proto = _references_hash_proto;
 lhq.replace = 0;
 lhq.value = node;
 lhq.pool = vm->mem_pool;
___
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel


[njs] Style.

2019-02-26 Thread Dmitry Volyntsev
details:   https://hg.nginx.org/njs/rev/1d6e32892413
branches:  
changeset: 807:1d6e32892413
user:  hongzhidao 
date:  Tue Feb 26 17:32:59 2019 +0800
description:
Style.

diffstat:

 njs/njs_disassembler.c |  48 
 1 files changed, 24 insertions(+), 24 deletions(-)

diffs (67 lines):

diff -r f70566bc1e62 -r 1d6e32892413 njs/njs_disassembler.c
--- a/njs/njs_disassembler.cTue Feb 26 17:11:50 2019 +0300
+++ b/njs/njs_disassembler.cTue Feb 26 17:32:59 2019 +0800
@@ -412,39 +412,39 @@ njs_disassemble(u_char *start, u_char *e
 n = nxt_nitems(code_names);
 
 do {
- if (operation == code_name->operation) {
- name = _name->name;
+if (operation == code_name->operation) {
+name = _name->name;
 
- if (code_name->size == sizeof(njs_vmcode_3addr_t)) {
- code3 = (njs_vmcode_3addr_t *) p;
+if (code_name->size == sizeof(njs_vmcode_3addr_t)) {
+code3 = (njs_vmcode_3addr_t *) p;
 
- printf("%05zd %*s  %04zX %04zX %04zX\n",
-p - start, (int) name->length, name->start,
-(size_t) code3->dst, (size_t) code3->src1,
-(size_t) code3->src2);
+printf("%05zd %*s  %04zX %04zX %04zX\n",
+   p - start, (int) name->length, name->start,
+   (size_t) code3->dst, (size_t) code3->src1,
+   (size_t) code3->src2);
 
- } else if (code_name->size == sizeof(njs_vmcode_2addr_t)) {
- code2 = (njs_vmcode_2addr_t *) p;
+} else if (code_name->size == sizeof(njs_vmcode_2addr_t)) {
+code2 = (njs_vmcode_2addr_t *) p;
 
- printf("%05zd %*s  %04zX %04zX\n",
-p - start, (int) name->length, name->start,
-(size_t) code2->dst, (size_t) code2->src);
+printf("%05zd %*s  %04zX %04zX\n",
+   p - start, (int) name->length, name->start,
+   (size_t) code2->dst, (size_t) code2->src);
 
- } else if (code_name->size == sizeof(njs_vmcode_1addr_t)) {
- code1 = (njs_vmcode_1addr_t *) p;
+} else if (code_name->size == sizeof(njs_vmcode_1addr_t)) {
+code1 = (njs_vmcode_1addr_t *) p;
 
- printf("%05zd %*s  %04zX\n",
-p - start, (int) name->length, name->start,
-(size_t) code1->index);
- }
+printf("%05zd %*s  %04zX\n",
+   p - start, (int) name->length, name->start,
+   (size_t) code1->index);
+}
 
- p += code_name->size;
+p += code_name->size;
 
- goto next;
- }
+goto next;
+}
 
- code_name++;
- n--;
+code_name++;
+n--;
 
 } while (n != 0);
 
___
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel


[njs] Style.

2019-02-25 Thread Dmitry Volyntsev
details:   https://hg.nginx.org/njs/rev/25b394b0e953
branches:  
changeset: 796:25b394b0e953
user:  Artem S. Povalyukhin 
date:  Sat Feb 23 04:20:23 2019 +0300
description:
Style.

diffstat:

 njs/njs_array.c |  30 +++---
 1 files changed, 15 insertions(+), 15 deletions(-)

diffs (40 lines):

diff -r c4522b3d3ff0 -r 25b394b0e953 njs/njs_array.c
--- a/njs/njs_array.c   Fri Feb 22 20:33:31 2019 +0300
+++ b/njs/njs_array.c   Sat Feb 23 04:20:23 2019 +0300
@@ -1406,21 +1406,21 @@ njs_array_prototype_fill(njs_vm_t *vm, n
 }
 }
 
-   if (nargs > 3) {
-   end = args[3].data.u.number;
-
-   if (end > length) {
-   end = length;
-   }
-
-   if (end < 0) {
-   end += length;
-
-   if (end < 0) {
-   end = 0;
-   }
-   }
-   }
+if (nargs > 3) {
+end = args[3].data.u.number;
+
+if (end > length) {
+end = length;
+}
+
+if (end < 0) {
+end += length;
+
+if (end < 0) {
+end = 0;
+}
+}
+}
 }
 
 for (i = start; i < end; i++) {
___
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel


[njs] Style.

2019-02-20 Thread Dmitry Volyntsev
details:   https://hg.nginx.org/njs/rev/7bb252625b94
branches:  
changeset: 791:7bb252625b94
user:  Dmitry Volyntsev 
date:  Wed Feb 20 21:04:22 2019 +0300
description:
Style.

diffstat:

 njs/njs_error.c |  2 +-
 njs/njs_error.h |  2 +-
 njs/njs_json.c  |  8 
 3 files changed, 6 insertions(+), 6 deletions(-)

diffs (63 lines):

diff -r 5764fb29b4c0 -r 7bb252625b94 njs/njs_error.c
--- a/njs/njs_error.c   Wed Feb 20 21:04:19 2019 +0300
+++ b/njs/njs_error.c   Wed Feb 20 21:04:22 2019 +0300
@@ -39,7 +39,7 @@ njs_error_new(njs_vm_t *vm, njs_value_t 
 
 void
 njs_error_fmt_new(njs_vm_t *vm, njs_value_t *dst, njs_value_type_t type,
-const char* fmt, ...)
+const char *fmt, ...)
 {
 va_list  args;
 u_char   buf[NXT_MAX_ERROR_STR], *p;
diff -r 5764fb29b4c0 -r 7bb252625b94 njs/njs_error.h
--- a/njs/njs_error.h   Wed Feb 20 21:04:19 2019 +0300
+++ b/njs/njs_error.h   Wed Feb 20 21:04:22 2019 +0300
@@ -35,7 +35,7 @@
 void njs_error_new(njs_vm_t *vm, njs_value_t *dst, njs_value_type_t type,
 u_char *start, size_t size);
 void njs_error_fmt_new(njs_vm_t *vm, njs_value_t *dst, njs_value_type_t type,
-const char* fmt, ...);
+const char *fmt, ...);
 
 void njs_memory_error(njs_vm_t *vm);
 void njs_memory_error_set(njs_vm_t *vm, njs_value_t *value);
diff -r 5764fb29b4c0 -r 7bb252625b94 njs/njs_json.c
--- a/njs/njs_json.cWed Feb 20 21:04:19 2019 +0300
+++ b/njs/njs_json.cWed Feb 20 21:04:22 2019 +0300
@@ -115,7 +115,7 @@ static njs_json_state_t *njs_json_push_p
 njs_json_parse_t *parse, njs_value_t *value);
 static njs_json_state_t *njs_json_pop_parse_state(njs_json_parse_t *parse);
 static void njs_json_parse_exception(njs_json_parse_ctx_t *ctx,
-const char* msg, const u_char *pos);
+const char *msg, const u_char *pos);
 
 static njs_ret_t njs_json_stringify_continuation(njs_vm_t *vm,
 njs_value_t *args, nxt_uint_t nargs, njs_index_t unused);
@@ -152,7 +152,7 @@ static njs_value_t *njs_json_wrap_value(
 #define njs_json_buf_node_room(n) (size_t) ((n)->end - (n)->pos)
 
 static nxt_int_t njs_json_buf_append(njs_json_stringify_t *stringify,
-const char* msg, size_t len);
+const char *msg, size_t len);
 static u_char *njs_json_buf_reserve(njs_json_stringify_t *stringify,
 size_t size);
 static nxt_int_t njs_json_buf_pullup(njs_json_stringify_t *stringify,
@@ -1126,7 +1126,7 @@ njs_json_pop_parse_state(njs_json_parse_
 
 
 static void
-njs_json_parse_exception(njs_json_parse_ctx_t *ctx, const char* msg,
+njs_json_parse_exception(njs_json_parse_ctx_t *ctx, const char *msg,
 const u_char *pos)
 {
 ssize_t  length;
@@ -1927,7 +1927,7 @@ njs_json_wrap_value(njs_vm_t *vm, njs_va
 
 
 static nxt_int_t
-njs_json_buf_append(njs_json_stringify_t *stringify, const char* msg,
+njs_json_buf_append(njs_json_stringify_t *stringify, const char *msg,
 size_t len)
 {
 u_char  *p;
___
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel


[njs] Style.

2019-02-14 Thread Dmitry Volyntsev
details:   https://hg.nginx.org/njs/rev/dde9a253361e
branches:  
changeset: 779:dde9a253361e
user:  Dmitry Volyntsev 
date:  Thu Feb 14 17:01:26 2019 +0300
description:
Style.

diffstat:

 nginx/ngx_http_js_module.c |  2 +-
 njs/njs_regexp.c   |  5 ++---
 2 files changed, 3 insertions(+), 4 deletions(-)

diffs (27 lines):

diff -r 3852b2044dfd -r dde9a253361e nginx/ngx_http_js_module.c
--- a/nginx/ngx_http_js_module.cThu Feb 14 15:21:02 2019 +0300
+++ b/nginx/ngx_http_js_module.cThu Feb 14 17:01:26 2019 +0300
@@ -1967,7 +1967,7 @@ ngx_http_js_ext_get_parent(njs_vm_t *vm,
 
 static njs_ret_t
 ngx_http_js_ext_get_reply_body(njs_vm_t *vm, njs_value_t *value, void *obj,
-   uintptr_t data)
+uintptr_t data)
 {
 size_t   len;
 u_char  *p;
diff -r 3852b2044dfd -r dde9a253361e njs/njs_regexp.c
--- a/njs/njs_regexp.c  Thu Feb 14 15:21:02 2019 +0300
+++ b/njs/njs_regexp.c  Thu Feb 14 17:01:26 2019 +0300
@@ -268,9 +268,8 @@ njs_regexp_pattern_create(njs_vm_t *vm, 
 size += ((flags & NJS_REGEXP_IGNORE_CASE) != 0);
 size += ((flags & NJS_REGEXP_MULTILINE) != 0);
 
-pattern = nxt_mp_zalloc(vm->mem_pool,
-   
sizeof(njs_regexp_pattern_t)
-+ 1 + length + size + 1);
+pattern = nxt_mp_zalloc(vm->mem_pool, sizeof(njs_regexp_pattern_t) + 1
+  + length + size + 1);
 if (nxt_slow_path(pattern == NULL)) {
 njs_memory_error(vm);
 return NULL;
___
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel


[njs] Style.

2019-01-30 Thread Dmitry Volyntsev
details:   https://hg.nginx.org/njs/rev/c7e18bd12776
branches:  
changeset: 742:c7e18bd12776
user:  hongzhidao 
date:  Tue Jan 29 01:30:04 2019 +0800
description:
Style.

diffstat:

 njs/njs_lexer_keyword.c |  8 
 njs/njs_module.h|  6 --
 njs/njs_parser.c|  2 +-
 3 files changed, 9 insertions(+), 7 deletions(-)

diffs (53 lines):

diff -r 348a34597bab -r c7e18bd12776 njs/njs_lexer_keyword.c
--- a/njs/njs_lexer_keyword.c   Tue Jan 29 18:15:03 2019 +0300
+++ b/njs/njs_lexer_keyword.c   Tue Jan 29 01:30:04 2019 +0800
@@ -88,10 +88,10 @@ static const njs_keyword_t  njs_keywords
 { nxt_string("encodeURIComponent"),  NJS_TOKEN_ENCODE_URI_COMPONENT, 0 },
 { nxt_string("decodeURI"), NJS_TOKEN_DECODE_URI, 0 },
 { nxt_string("decodeURIComponent"),  NJS_TOKEN_DECODE_URI_COMPONENT, 0 },
-{ nxt_string("require"),  NJS_TOKEN_REQUIRE, 0 },
-{ nxt_string("setTimeout"),   NJS_TOKEN_SET_TIMEOUT, 0 },
-{ nxt_string("setImmediate"), NJS_TOKEN_SET_IMMEDIATE, 0 },
-{ nxt_string("clearTimeout"), NJS_TOKEN_CLEAR_TIMEOUT, 0 },
+{ nxt_string("require"),   NJS_TOKEN_REQUIRE, 0 },
+{ nxt_string("setTimeout"),NJS_TOKEN_SET_TIMEOUT, 0 },
+{ nxt_string("setImmediate"),  NJS_TOKEN_SET_IMMEDIATE, 0 },
+{ nxt_string("clearTimeout"),  NJS_TOKEN_CLEAR_TIMEOUT, 0 },
 
 /* Reserved words. */
 
diff -r 348a34597bab -r c7e18bd12776 njs/njs_module.h
--- a/njs/njs_module.h  Tue Jan 29 18:15:03 2019 +0300
+++ b/njs/njs_module.h  Tue Jan 29 01:30:04 2019 +0800
@@ -7,6 +7,7 @@
 #ifndef _NJS_MODULE_H_INCLUDED_
 #define _NJS_MODULE_H_INCLUDED_
 
+
 typedef struct {
 nxt_str_t   name;
 njs_object_tobject;
@@ -16,8 +17,9 @@ typedef struct {
 njs_ret_t njs_module_require(njs_vm_t *vm, njs_value_t *args,
 nxt_uint_t nargs, njs_index_t unused);
 
-extern const nxt_lvlhsh_proto_t  njs_modules_hash_proto;
 
-extern const njs_object_init_t  njs_require_function_init;
+extern const nxt_lvlhsh_proto_t  njs_modules_hash_proto;
+extern const njs_object_init_t   njs_require_function_init;
+
 
 #endif /* _NJS_MODULE_H_INCLUDED_ */
diff -r 348a34597bab -r c7e18bd12776 njs/njs_parser.c
--- a/njs/njs_parser.c  Tue Jan 29 18:15:03 2019 +0300
+++ b/njs/njs_parser.c  Tue Jan 29 01:30:04 2019 +0800
@@ -720,7 +720,7 @@ njs_parser_function_lambda(njs_vm_t *vm,
 }
 }
 
-token =  njs_parser_token(parser);
+token = njs_parser_token(parser);
 if (nxt_slow_path(token <= NJS_TOKEN_ILLEGAL)) {
 return token;
 }
___
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel


[njs] Style.

2019-01-18 Thread Dmitry Volyntsev
details:   https://hg.nginx.org/njs/rev/1ebf0773c44f
branches:  
changeset: 733:1ebf0773c44f
user:  Dmitry Volyntsev 
date:  Fri Jan 18 14:50:50 2019 +0300
description:
Style.

diffstat:

 njs/njs_extern.c|  2 +-
 njs/njs_generator.c |  2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diffs (24 lines):

diff -r 3b1239c2ee12 -r 1ebf0773c44f njs/njs_extern.c
--- a/njs/njs_extern.c  Thu Jan 17 17:01:22 2019 +0300
+++ b/njs/njs_extern.c  Fri Jan 18 14:50:50 2019 +0300
@@ -173,7 +173,7 @@ njs_vm_external_prototype(njs_vm_t *vm, 
 
 nxt_int_t
 njs_vm_external_create(njs_vm_t *vm, njs_value_t *ext_val,
-const njs_extern_t *proto,  njs_external_ptr_t object)
+const njs_extern_t *proto, njs_external_ptr_t object)
 {
 void  *obj;
 
diff -r 3b1239c2ee12 -r 1ebf0773c44f njs/njs_generator.c
--- a/njs/njs_generator.c   Thu Jan 17 17:01:22 2019 +0300
+++ b/njs/njs_generator.c   Fri Jan 18 14:50:50 2019 +0300
@@ -817,7 +817,7 @@ njs_generate_switch_statement(njs_vm_t *
 njs_parser_node_t*node, *expr, *branch;
 njs_vmcode_move_t*move;
 njs_vmcode_jump_t*jump;
-njs_generator_patch_t   *patch, *next, *patches, **last;
+njs_generator_patch_t*patch, *next, *patches, **last;
 njs_vmcode_equal_jump_t  *equal;
 
 /* The "switch" expression. */
___
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel


[njs] Style.

2018-12-07 Thread Dmitry Volyntsev
details:   https://hg.nginx.org/njs/rev/0709c3d38212
branches:  
changeset: 690:0709c3d38212
user:  Dmitry Volyntsev 
date:  Fri Dec 07 18:58:27 2018 +0300
description:
Style.

diffstat:

 njs/njs_generator.c |  2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diffs (12 lines):

diff -r 837f82cdd3ba -r 0709c3d38212 njs/njs_generator.c
--- a/njs/njs_generator.c   Fri Dec 07 18:54:59 2018 +0300
+++ b/njs/njs_generator.c   Fri Dec 07 18:58:27 2018 +0300
@@ -438,7 +438,7 @@ njs_generate_reserve(njs_vm_t *vm, njs_g
 size *= 2;
 
 } else {
-size += size/ 2;
+size += size / 2;
 }
 
 p = nxt_mem_cache_alloc(vm->mem_cache_pool, size);
___
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel


[njs] Style.

2018-07-16 Thread Sergey Kandaurov
details:   http://hg.nginx.org/njs/rev/44cf55b40b6b
branches:  
changeset: 556:44cf55b40b6b
user:  Sergey Kandaurov 
date:  Mon Jul 16 14:20:16 2018 +0300
description:
Style.

diffstat:

 nxt/auto/getrandom |  1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diffs (11 lines):

diff -r 00762256c67a -r 44cf55b40b6b nxt/auto/getrandom
--- a/nxt/auto/getrandomFri Jul 13 15:12:11 2018 +0300
+++ b/nxt/auto/getrandomMon Jul 16 14:20:16 2018 +0300
@@ -24,6 +24,7 @@ nxt_feature_test="#include 
   }"
 . ${NXT_AUTO}feature
 
+
 if [ $nxt_found = no ]; then
 
 # Linux 3.17 SYS_getrandom.
___
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel


[njs] Style fixes.

2018-07-03 Thread Igor Sysoev
details:   http://hg.nginx.org/njs/rev/c1f9fe4022bc
branches:  
changeset: 553:c1f9fe4022bc
user:  Igor Sysoev 
date:  Tue Jul 03 15:48:04 2018 +0300
description:
Style fixes.

diffstat:

 njs/njs_error.h  |  3 ++-
 njs/njs_fs.c |  4 ++--
 njs/njs_object.c |  3 ++-
 njs/njs_string.c |  4 ++--
 njs/njs_string.h |  4 ++--
 5 files changed, 10 insertions(+), 8 deletions(-)

diffs (69 lines):

diff -r 3aef480987d6 -r c1f9fe4022bc njs/njs_error.h
--- a/njs/njs_error.h   Tue Jul 03 15:48:03 2018 +0300
+++ b/njs/njs_error.h   Tue Jul 03 15:48:04 2018 +0300
@@ -13,7 +13,8 @@
 #define njs_eval_error(vm, fmt, ...)  \
 njs_exception_error_create(vm, NJS_OBJECT_EVAL_ERROR, fmt, ##__VA_ARGS__)
 #define njs_internal_error(vm, fmt, ...)  \
-njs_exception_error_create(vm, NJS_OBJECT_INTERNAL_ERROR, fmt, 
##__VA_ARGS__)
+njs_exception_error_create(vm, NJS_OBJECT_INTERNAL_ERROR, fmt,\
+   ##__VA_ARGS__)
 #define njs_range_error(vm, fmt, ...) \
 njs_exception_error_create(vm, NJS_OBJECT_RANGE_ERROR, fmt, ##__VA_ARGS__)
 #define njs_reference_error(vm, fmt, ...) \
diff -r 3aef480987d6 -r c1f9fe4022bc njs/njs_fs.c
--- a/njs/njs_fs.c  Tue Jul 03 15:48:03 2018 +0300
+++ b/njs/njs_fs.c  Tue Jul 03 15:48:04 2018 +0300
@@ -43,8 +43,8 @@ static njs_ret_t njs_fs_write_file_sync(
 nxt_uint_t nargs, njs_index_t unused);
 static njs_ret_t njs_fs_write_file_internal(njs_vm_t *vm, njs_value_t *args,
 nxt_uint_t nargs, int default_flags);
-static njs_ret_t njs_fs_write_file_sync_internal(njs_vm_t *vm, njs_value_t 
*args,
-nxt_uint_t nargs, int default_flags);
+static njs_ret_t njs_fs_write_file_sync_internal(njs_vm_t *vm,
+njs_value_t *args, nxt_uint_t nargs, int default_flags);
 static njs_ret_t njs_fs_done(njs_vm_t *vm, njs_value_t *args,
 nxt_uint_t nargs, njs_index_t unused);
 
diff -r 3aef480987d6 -r c1f9fe4022bc njs/njs_object.c
--- a/njs/njs_object.c  Tue Jul 03 15:48:03 2018 +0300
+++ b/njs/njs_object.c  Tue Jul 03 15:48:04 2018 +0300
@@ -631,7 +631,8 @@ njs_object_keys(njs_vm_t *vm, njs_value_
 return NXT_OK;
 }
 
-njs_array_t*
+
+njs_array_t *
 njs_object_keys_array(njs_vm_t *vm, const njs_value_t *object)
 {
 size_t size;
diff -r 3aef480987d6 -r c1f9fe4022bc njs/njs_string.c
--- a/njs/njs_string.c  Tue Jul 03 15:48:03 2018 +0300
+++ b/njs/njs_string.c  Tue Jul 03 15:48:04 2018 +0300
@@ -716,8 +716,8 @@ njs_string_prototype_value_of(njs_vm_t *
  */
 
 static njs_ret_t
-njs_string_prototype_to_string(njs_vm_t *vm, njs_value_t *args, nxt_uint_t 
nargs,
-njs_index_t unused)
+njs_string_prototype_to_string(njs_vm_t *vm, njs_value_t *args,
+nxt_uint_t nargs, njs_index_t unused)
 {
 nxt_int_t  ret;
 nxt_str_t  enc, str;
diff -r 3aef480987d6 -r c1f9fe4022bc njs/njs_string.h
--- a/njs/njs_string.h  Tue Jul 03 15:48:03 2018 +0300
+++ b/njs/njs_string.h  Tue Jul 03 15:48:04 2018 +0300
@@ -126,9 +126,9 @@ njs_ret_t njs_string_new(njs_vm_t *vm, n
 njs_ret_t njs_string_hex(njs_vm_t *vm, njs_value_t *value,
 const nxt_str_t *src);
 njs_ret_t njs_string_base64(njs_vm_t *vm, njs_value_t *value,
-   const nxt_str_t *src);
+const nxt_str_t *src);
 njs_ret_t njs_string_base64url(njs_vm_t *vm, njs_value_t *value,
-   const nxt_str_t *src);
+const nxt_str_t *src);
 void njs_string_copy(njs_value_t *dst, njs_value_t *src);
 njs_ret_t njs_string_validate(njs_vm_t *vm, njs_string_prop_t *string,
 njs_value_t *value);
___
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel


[njs] Style.

2018-05-14 Thread Roman Arutyunyan
details:   http://hg.nginx.org/njs/rev/a994ab62d351
branches:  
changeset: 522:a994ab62d351
user:  Roman Arutyunyan 
date:  Mon May 14 15:03:29 2018 +0300
description:
Style.

diffstat:

 nginx/ngx_http_js_module.c   |  2 +-
 nginx/ngx_stream_js_module.c |  2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diffs (24 lines):

diff -r 5abcdd645d57 -r a994ab62d351 nginx/ngx_http_js_module.c
--- a/nginx/ngx_http_js_module.cTue Apr 17 17:15:27 2018 +0300
+++ b/nginx/ngx_http_js_module.cMon May 14 15:03:29 2018 +0300
@@ -174,7 +174,7 @@ static ngx_command_t  ngx_http_js_comman
   0,
   NULL },
 
-ngx_null_command
+  ngx_null_command
 };
 
 
diff -r 5abcdd645d57 -r a994ab62d351 nginx/ngx_stream_js_module.c
--- a/nginx/ngx_stream_js_module.c  Tue Apr 17 17:15:27 2018 +0300
+++ b/nginx/ngx_stream_js_module.c  Mon May 14 15:03:29 2018 +0300
@@ -123,7 +123,7 @@ static ngx_command_t  ngx_stream_js_comm
   offsetof(ngx_stream_js_srv_conf_t, filter),
   NULL },
 
-ngx_null_command
+  ngx_null_command
 };
 
 
___
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel


[njs] Style fixes.

2018-04-03 Thread Igor Sysoev
details:   http://hg.nginx.org/njs/rev/39374a5d6cda
branches:  
changeset: 489:39374a5d6cda
user:  Igor Sysoev 
date:  Tue Apr 03 17:55:23 2018 +0300
description:
Style fixes.

diffstat:

 njs/njs_parser.h|   4 ++--
 njs/njs_parser_expression.c |  20 ++--
 njs/njs_vm.c|   4 +---
 3 files changed, 13 insertions(+), 15 deletions(-)

diffs (66 lines):

diff -r addefc71957b -r 39374a5d6cda njs/njs_parser.h
--- a/njs/njs_parser.h  Tue Apr 03 17:55:08 2018 +0300
+++ b/njs/njs_parser.h  Tue Apr 03 17:55:23 2018 +0300
@@ -389,9 +389,9 @@ nxt_bool_t njs_parser_has_side_effect(nj
 u_char *njs_parser_trace_handler(nxt_trace_t *trace, nxt_trace_data_t *td,
 u_char *start);
 void njs_parser_syntax_error(njs_vm_t *vm, njs_parser_t *parser,
-   const char* fmt, ...);
+const char* fmt, ...);
 void njs_parser_ref_error(njs_vm_t *vm, njs_parser_t *parser, const char* fmt,
-   ...);
+...);
 nxt_int_t njs_generate_scope(njs_vm_t *vm, njs_parser_t *parser,
 njs_parser_node_t *node);
 
diff -r addefc71957b -r 39374a5d6cda njs/njs_parser_expression.c
--- a/njs/njs_parser_expression.c   Tue Apr 03 17:55:08 2018 +0300
+++ b/njs/njs_parser_expression.c   Tue Apr 03 17:55:23 2018 +0300
@@ -873,11 +873,11 @@ njs_parser_inc_dec_expression(njs_vm_t *
 node->left = parser->node;
 parser->node = node;
 
-parser->code_size += (node->token == NJS_TOKEN_NAME) ?
- sizeof(njs_vmcode_3addr_t):
- sizeof(njs_vmcode_prop_get_t)
- + sizeof(njs_vmcode_3addr_t)
- + sizeof(njs_vmcode_prop_set_t);
+parser->code_size += (token == NJS_TOKEN_NAME)
+ ? sizeof(njs_vmcode_3addr_t)
+ : sizeof(njs_vmcode_prop_get_t)
+   + sizeof(njs_vmcode_3addr_t)
+   + sizeof(njs_vmcode_prop_set_t);
 
 return next;
 }
@@ -929,11 +929,11 @@ njs_parser_post_inc_dec_expression(njs_v
 node->left = parser->node;
 parser->node = node;
 
-parser->code_size += (parser->node->token == NJS_TOKEN_NAME) ?
- sizeof(njs_vmcode_3addr_t):
- sizeof(njs_vmcode_prop_get_t)
- + sizeof(njs_vmcode_3addr_t)
- + sizeof(njs_vmcode_prop_set_t);
+parser->code_size += (token == NJS_TOKEN_NAME)
+ ? sizeof(njs_vmcode_3addr_t)
+ : sizeof(njs_vmcode_prop_get_t)
+   + sizeof(njs_vmcode_3addr_t)
+   + sizeof(njs_vmcode_prop_set_t);
 
 return njs_parser_token(parser);
 }
diff -r addefc71957b -r 39374a5d6cda njs/njs_vm.c
--- a/njs/njs_vm.c  Tue Apr 03 17:55:08 2018 +0300
+++ b/njs/njs_vm.c  Tue Apr 03 17:55:23 2018 +0300
@@ -2394,9 +2394,7 @@ njs_vmcode_method_frame(njs_vm_t *vm, nj
 break;
 
 case NXT_ERROR:
-
-/* An exception was set in  njs_property_query(). */
-
+/* An exception was set in njs_property_query(). */
 return NXT_ERROR;
 
 default:
___
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel


[njs] Style fix in Unicode header files and Perl scripts which

2017-08-08 Thread Igor Sysoev
details:   http://hg.nginx.org/njs/rev/49a8c7cfb121
branches:  
changeset: 393:49a8c7cfb121
user:  Igor Sysoev 
date:  Tue Aug 08 17:47:56 2017 +0300
description:
Style fix in Unicode header files and Perl scripts which
generate the files.

diffstat:

 nxt/nxt_unicode_lower_case.h  |  108 -
 nxt/nxt_unicode_lower_case.pl |9 ++-
 nxt/nxt_unicode_upper_case.h  |  120 +++--
 nxt/nxt_unicode_upper_case.pl |8 ++-
 4 files changed, 183 insertions(+), 62 deletions(-)

diffs (684 lines):

diff -r bc306c37d037 -r 49a8c7cfb121 nxt/nxt_unicode_lower_case.h
--- a/nxt/nxt_unicode_lower_case.h  Tue Aug 08 17:47:55 2017 +0300
+++ b/nxt/nxt_unicode_lower_case.h  Tue Aug 08 17:47:56 2017 +0300
@@ -9,7 +9,9 @@
 #define NXT_UNICODE_BLOCK_SIZE  128
 
 
-static const uint32_t  nxt_unicode_lower_case_block_000[128]  nxt_aligned(64) 
= {
+static const uint32_t  nxt_unicode_lower_case_block_000[128]
+nxt_aligned(64) =
+{
 0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7,
 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf,
 0x00010, 0x00011, 0x00012, 0x00013, 0x00014, 0x00015, 0x00016, 0x00017,
@@ -29,7 +31,9 @@ static const uint32_t  nxt_unicode_lower
 };
 
 
-static const uint32_t  nxt_unicode_lower_case_block_001[128]  nxt_aligned(64) 
= {
+static const uint32_t  nxt_unicode_lower_case_block_001[128]
+nxt_aligned(64) =
+{
 0x00080, 0x00081, 0x00082, 0x00083, 0x00084, 0x00085, 0x00086, 0x00087,
 0x00088, 0x00089, 0x0008a, 0x0008b, 0x0008c, 0x0008d, 0x0008e, 0x0008f,
 0x00090, 0x00091, 0x00092, 0x00093, 0x00094, 0x00095, 0x00096, 0x00097,
@@ -49,7 +53,9 @@ static const uint32_t  nxt_unicode_lower
 };
 
 
-static const uint32_t  nxt_unicode_lower_case_block_002[128]  nxt_aligned(64) 
= {
+static const uint32_t  nxt_unicode_lower_case_block_002[128]
+nxt_aligned(64) =
+{
 0x00101, 0x00101, 0x00103, 0x00103, 0x00105, 0x00105, 0x00107, 0x00107,
 0x00109, 0x00109, 0x0010b, 0x0010b, 0x0010d, 0x0010d, 0x0010f, 0x0010f,
 0x00111, 0x00111, 0x00113, 0x00113, 0x00115, 0x00115, 0x00117, 0x00117,
@@ -69,7 +75,9 @@ static const uint32_t  nxt_unicode_lower
 };
 
 
-static const uint32_t  nxt_unicode_lower_case_block_003[128]  nxt_aligned(64) 
= {
+static const uint32_t  nxt_unicode_lower_case_block_003[128]
+nxt_aligned(64) =
+{
 0x00180, 0x00253, 0x00183, 0x00183, 0x00185, 0x00185, 0x00254, 0x00188,
 0x00188, 0x00256, 0x00257, 0x0018c, 0x0018c, 0x0018d, 0x001dd, 0x00259,
 0x0025b, 0x00192, 0x00192, 0x00260, 0x00263, 0x00195, 0x00269, 0x00268,
@@ -89,7 +97,9 @@ static const uint32_t  nxt_unicode_lower
 };
 
 
-static const uint32_t  nxt_unicode_lower_case_block_004[128]  nxt_aligned(64) 
= {
+static const uint32_t  nxt_unicode_lower_case_block_004[128]
+nxt_aligned(64) =
+{
 0x00201, 0x00201, 0x00203, 0x00203, 0x00205, 0x00205, 0x00207, 0x00207,
 0x00209, 0x00209, 0x0020b, 0x0020b, 0x0020d, 0x0020d, 0x0020f, 0x0020f,
 0x00211, 0x00211, 0x00213, 0x00213, 0x00215, 0x00215, 0x00217, 0x00217,
@@ -109,7 +119,9 @@ static const uint32_t  nxt_unicode_lower
 };
 
 
-static const uint32_t  nxt_unicode_lower_case_block_006[128]  nxt_aligned(64) 
= {
+static const uint32_t  nxt_unicode_lower_case_block_006[128]
+nxt_aligned(64) =
+{
 0x00300, 0x00301, 0x00302, 0x00303, 0x00304, 0x00305, 0x00306, 0x00307,
 0x00308, 0x00309, 0x0030a, 0x0030b, 0x0030c, 0x0030d, 0x0030e, 0x0030f,
 0x00310, 0x00311, 0x00312, 0x00313, 0x00314, 0x00315, 0x00316, 0x00317,
@@ -129,7 +141,9 @@ static const uint32_t  nxt_unicode_lower
 };
 
 
-static const uint32_t  nxt_unicode_lower_case_block_007[128]  nxt_aligned(64) 
= {
+static const uint32_t  nxt_unicode_lower_case_block_007[128]
+nxt_aligned(64) =
+{
 0x00380, 0x00381, 0x00382, 0x00383, 0x00384, 0x00385, 0x003ac, 0x00387,
 0x003ad, 0x003ae, 0x003af, 0x0038b, 0x003cc, 0x0038d, 0x003cd, 0x003ce,
 0x00390, 0x003b1, 0x003b2, 0x003b3, 0x003b4, 0x003b5, 0x003b6, 0x003b7,
@@ -149,7 +163,9 @@ static const uint32_t  nxt_unicode_lower
 };
 
 
-static const uint32_t  nxt_unicode_lower_case_block_008[128]  nxt_aligned(64) 
= {
+static const uint32_t  nxt_unicode_lower_case_block_008[128]
+nxt_aligned(64) =
+{
 0x00450, 0x00451, 0x00452, 0x00453, 0x00454, 0x00455, 0x00456, 0x00457,
 0x00458, 0x00459, 0x0045a, 0x0045b, 0x0045c, 0x0045d, 0x0045e, 0x0045f,
 0x00430, 0x00431, 0x00432, 0x00433, 0x00434, 0x00435, 0x00436, 0x00437,
@@ -169,7 +185,9 @@ static const uint32_t  nxt_unicode_lower
 };
 
 
-static const uint32_t  nxt_unicode_lower_case_block_009[128]  nxt_aligned(64) 
= {
+static const uint32_t  nxt_unicode_lower_case_block_009[128]
+nxt_aligned(64) =
+{
 0x00481, 0x00481, 0x00482, 0x00483, 0x00484, 0x00485, 0x00486, 0x00487,
 0x00488, 0x00489, 0x0048b, 0x0048b, 0x0048d, 0x0048d, 0x0048f, 0x0048f,
 0x00491, 0x00491, 0x00493, 0x00493, 

[njs] Style fixes.

2017-08-08 Thread Igor Sysoev
details:   http://hg.nginx.org/njs/rev/e2baf506be4c
branches:  
changeset: 391:e2baf506be4c
user:  Igor Sysoev 
date:  Tue Aug 08 17:47:53 2017 +0300
description:
Style fixes.

diffstat:

 njs/njs_generator.c |  5 +
 njs/njs_variable.c  |  3 ---
 2 files changed, 1 insertions(+), 7 deletions(-)

diffs (59 lines):

diff -r c347ea0bbdd6 -r e2baf506be4c njs/njs_generator.c
--- a/njs/njs_generator.c   Tue Jul 18 19:25:50 2017 +0300
+++ b/njs/njs_generator.c   Tue Aug 08 17:47:53 2017 +0300
@@ -380,7 +380,7 @@ njs_generate_builtin_object(njs_vm_t *vm
 
 node->index = njs_generator_dest_index(vm, parser, node);
 if (nxt_slow_path(node->index == NJS_INDEX_ERROR)) {
-return node->index;
+return NXT_ERROR;
 }
 
 njs_generate_code(parser, njs_vmcode_object_copy_t, copy);
@@ -2541,13 +2541,11 @@ njs_generator_temp_index_get(njs_vm_t *v
 }
 
 if (vm->accumulative && scope->type == NJS_SCOPE_GLOBAL) {
-
 /*
  * When non-clonable VM runs in accumulative mode
  * all global variables are allocated in absolute scope
  * to simplify global scope handling.
  */
-
 value = nxt_mem_cache_align(vm->mem_cache_pool, sizeof(njs_value_t),
 sizeof(njs_value_t));
 if (nxt_slow_path(value == NULL)) {
@@ -2557,7 +2555,6 @@ njs_generator_temp_index_get(njs_vm_t *v
 index = (njs_index_t) value;
 
 } else {
-
 value = nxt_array_add(scope->values[0], _array_mem_proto,
   vm->mem_cache_pool);
 if (nxt_slow_path(value == NULL)) {
diff -r c347ea0bbdd6 -r e2baf506be4c njs/njs_variable.c
--- a/njs/njs_variable.cTue Jul 18 19:25:50 2017 +0300
+++ b/njs/njs_variable.cTue Aug 08 17:47:53 2017 +0300
@@ -356,13 +356,11 @@ njs_variable_get(njs_vm_t *vm, njs_parse
 }
 
 if (vm->accumulative && vs.scope->type == NJS_SCOPE_GLOBAL) {
-
 /*
  * When non-clonable VM runs in accumulative mode all
  * global variables should be allocated in absolute scope
  * to share them among consecutive VM invocations.
  */
-
 value = nxt_mem_cache_align(vm->mem_cache_pool, sizeof(njs_value_t),
 sizeof(njs_value_t));
 if (nxt_slow_path(value == NULL)) {
@@ -391,7 +389,6 @@ njs_variable_get(njs_vm_t *vm, njs_parse
 
 index = vs.scope->next_index[n];
 vs.scope->next_index[n] += sizeof(njs_value_t);
-
 }
 
 if (njs_is_object(>value)) {
___
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel


[njs] Style fixes and small miscellaneous changes.

2017-06-27 Thread Igor Sysoev
details:   http://hg.nginx.org/njs/rev/30cc8990272a
branches:  
changeset: 378:30cc8990272a
user:  Igor Sysoev 
date:  Tue Jun 27 11:17:54 2017 +0300
description:
Style fixes and small miscellaneous changes.

diffstat:

 nginx/ngx_http_js_module.c |   2 +-
 njs/njs_date.c |   4 ++--
 njs/njs_number.c   |  14 +++---
 njs/njs_object.c   |   4 ++--
 njs/njs_string.c   |  24 
 nxt/nxt_lvlhsh.c   |   4 ++--
 nxt/nxt_lvlhsh.h   |  12 ++--
 nxt/nxt_rbtree.c   |   1 -
 nxt/nxt_utf8.c |   2 +-
 9 files changed, 29 insertions(+), 38 deletions(-)

diffs (223 lines):

diff -r d882561d50e8 -r 30cc8990272a nginx/ngx_http_js_module.c
--- a/nginx/ngx_http_js_module.cFri Jun 23 15:49:09 2017 +0300
+++ b/nginx/ngx_http_js_module.cTue Jun 27 11:17:54 2017 +0300
@@ -139,7 +139,7 @@ static ngx_command_t  ngx_http_js_comman
 { ngx_string("js_set"),
   NGX_HTTP_MAIN_CONF|NGX_CONF_TAKE2,
   ngx_http_js_set,
-  NGX_HTTP_LOC_CONF_OFFSET,
+  0,
   0,
   NULL },
 
diff -r d882561d50e8 -r 30cc8990272a njs/njs_date.c
--- a/njs/njs_date.cFri Jun 23 15:49:09 2017 +0300
+++ b/njs/njs_date.cTue Jun 27 11:17:54 2017 +0300
@@ -1052,8 +1052,8 @@ njs_date_prototype_to_iso_string(njs_vm_
 year = tm.tm_year + 1900;
 
 size = snprintf((char *) buf, NJS_ISO_DATE_TIME_LEN,
-(year < 0) ? "%07d-%02d-%02dT%02d:%02d:%02d.%03dZ":
- "%04d-%02d-%02dT%02d:%02d:%02d.%03dZ",
+(year < 0) ? "%07d-%02d-%02dT%02d:%02d:%02d.%03dZ"
+   : "%04d-%02d-%02dT%02d:%02d:%02d.%03dZ",
 year, tm.tm_mon + 1, tm.tm_mday,
 tm.tm_hour, tm.tm_min, tm.tm_sec,
 (int) ((int64_t) time % 1000));
diff -r d882561d50e8 -r 30cc8990272a njs/njs_number.c
--- a/njs/njs_number.c  Fri Jun 23 15:49:09 2017 +0300
+++ b/njs/njs_number.c  Tue Jun 27 11:17:54 2017 +0300
@@ -89,7 +89,7 @@ njs_number_dec_parse(u_char **start, u_c
 num = 0;
 
 while (p < end) {
-/* Values below '0' become >= 208. */
+/* Values less than '0' become >= 208. */
 c = *p - '0';
 
 if (nxt_slow_path(c > 9)) {
@@ -106,7 +106,7 @@ njs_number_dec_parse(u_char **start, u_c
 scale = 1;
 
 for (p++; p < end; p++) {
-/* Values below '0' become >= 208. */
+/* Values less than '0' become >= 208. */
 c = *p - '0';
 
 if (nxt_slow_path(c > 9)) {
@@ -135,7 +135,7 @@ njs_number_dec_parse(u_char **start, u_c
 }
 }
 
-/* Values below '0' become >= 208. */
+/* Values less than '0' become >= 208. */
 c = *e - '0';
 
 if (nxt_fast_path(c <= 9)) {
@@ -143,7 +143,7 @@ njs_number_dec_parse(u_char **start, u_c
 p = e + 1;
 
 while (p < end) {
-/* Values below '0' become >= 208. */
+/* Values less than '0' become >= 208. */
 c = *p - '0';
 
 if (nxt_slow_path(c > 9)) {
@@ -180,11 +180,11 @@ njs_number_hex_parse(u_char **start, u_c
 while (p < end) {
 c = (u_char) (*p | 0x20);
 
-/* Values below '0' become >= 208. */
+/* Values less than '0' become >= 208. */
 c = c - '0';
 
 if (c > 9) {
-/* Values below 'a' become >= 159. */
+/* Values less than 'a' become >= 159. */
 c = c - ('a' - '0');
 
 if (nxt_slow_path(c > 5)) {
@@ -800,7 +800,7 @@ njs_number_parse_int(njs_vm_t *vm, njs_v
 n = njs_number_radix_parse(, end, radix);
 
 if (n >= 0) {
-num = (minus) ? -n : n;
+num = minus ? -n : n;
 }
 }
 
diff -r d882561d50e8 -r 30cc8990272a njs/njs_object.c
--- a/njs/njs_object.c  Fri Jun 23 15:49:09 2017 +0300
+++ b/njs/njs_object.c  Tue Jun 27 11:17:54 2017 +0300
@@ -915,8 +915,8 @@ njs_object_is_extensible(njs_vm_t *vm, n
 return NXT_ERROR;
 }
 
-retval = args[1].data.u.object->extensible ? _string_true :
- _string_false;
+retval = args[1].data.u.object->extensible ? _string_true
+   : _string_false;
 
 vm->retval = *retval;
 
diff -r d882561d50e8 -r 30cc8990272a njs/njs_string.c
--- a/njs/njs_string.c  Fri Jun 23 15:49:09 2017 +0300
+++ b/njs/njs_string.c  Tue Jun 27 11:17:54 2017 +0300
@@ -2555,11 +2555,11 @@ static njs_ret_t
 njs_string_replace_search(njs_vm_t *vm, njs_value_t *args,
 njs_string_replace_t *r)
 {
-intcaptures[2];
-u_char *p, *end;
-size_t size;
-njs_ret_t  ret;
-nxt_str_t  search;
+intcaptures[2];
+u_char *p, *end;
+size_t size;
+njs_ret_t  ret;

[njs] Style fixes and small miscellaneous changes.

2017-04-04 Thread Igor Sysoev
details:   http://hg.nginx.org/njs/rev/7e6460db39ad
branches:  
changeset: 337:7e6460db39ad
user:  Igor Sysoev 
date:  Tue Apr 04 13:23:10 2017 +0300
description:
Style fixes and small miscellaneous changes.

diffstat:

 njs/njs_array.c|  2 +-
 njs/njs_function.c |  4 ++--
 njs/njs_parser.c   |  2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diffs (45 lines):

diff -r f62632793238 -r 7e6460db39ad njs/njs_array.c
--- a/njs/njs_array.c   Tue Apr 04 11:00:49 2017 +0300
+++ b/njs/njs_array.c   Tue Apr 04 13:23:10 2017 +0300
@@ -2044,7 +2044,7 @@ njs_array_prototype_sort_continuation(nj
 sort->current++;
 n = sort->current;
 
-} while (sort->current < array->length);
+} while (n < array->length);
 }
 
 vm->retval = args[0];
diff -r f62632793238 -r 7e6460db39ad njs/njs_function.c
--- a/njs/njs_function.cTue Apr 04 11:00:49 2017 +0300
+++ b/njs/njs_function.cTue Apr 04 13:23:10 2017 +0300
@@ -162,7 +162,7 @@ njs_function_frame(njs_vm_t *vm, njs_fun
 nxt_bool_t ctor)
 {
 size_t size;
-nxt_uint_t n, max_args, closures;;
+nxt_uint_t n, max_args, closures;
 njs_value_t*value, *bound;
 njs_frame_t*frame;
 njs_native_frame_t *native_frame;
@@ -594,7 +594,7 @@ njs_function_activate(njs_vm_t *vm, njs_
 cont->retval = retval;
 
 cont->return_address = vm->current
-   + sizeof(njs_vmcode_function_call_t);;
+   + sizeof(njs_vmcode_function_call_t);
 vm->current = (u_char *) njs_continuation_nexus;
 
 return NJS_APPLIED;
diff -r f62632793238 -r 7e6460db39ad njs/njs_parser.c
--- a/njs/njs_parser.c  Tue Apr 04 11:00:49 2017 +0300
+++ b/njs/njs_parser.c  Tue Apr 04 13:23:10 2017 +0300
@@ -178,7 +178,7 @@ njs_parser_scope_begin(njs_vm_t *vm, njs
 if (type == NJS_SCOPE_FUNCTION) {
 scope->next_index[0] = type;
 scope->next_index[1] = NJS_SCOPE_CLOSURE + nesting
-   + sizeof(njs_value_t);;
+   + sizeof(njs_value_t);
 
 } else {
 if (type == NJS_SCOPE_GLOBAL) {
___
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel


[njs] Style fixes.

2017-03-31 Thread Igor Sysoev
details:   http://hg.nginx.org/njs/rev/dc8af19bf47d
branches:  
changeset: 326:dc8af19bf47d
user:  Andrey Zelenkov 
date:  Fri Mar 31 14:05:44 2017 +0300
description:
Style fixes.

diffstat:

 njs/njs_regexp.c |  2 +-
 njs/njs_string.c |  2 +-
 njs/njs_vm.c |  6 +++---
 3 files changed, 5 insertions(+), 5 deletions(-)

diffs (54 lines):

diff -r 8e20f235b71e -r dc8af19bf47d njs/njs_regexp.c
--- a/njs/njs_regexp.c  Fri Mar 31 14:02:38 2017 +0300
+++ b/njs/njs_regexp.c  Fri Mar 31 14:05:44 2017 +0300
@@ -565,7 +565,7 @@ njs_regexp_prototype_to_string(njs_vm_t 
 
 value = [0];
 
-if (value->type == NJS_REGEXP) {
+if (njs_is_regexp(value)) {
 pattern = value->data.u.regexp->pattern;
 source = pattern->source;
 
diff -r 8e20f235b71e -r dc8af19bf47d njs/njs_string.c
--- a/njs/njs_string.c  Fri Mar 31 14:02:38 2017 +0300
+++ b/njs/njs_string.c  Fri Mar 31 14:05:44 2017 +0300
@@ -3573,7 +3573,7 @@ njs_values_hash_test(nxt_lvlhsh_query_t 
 return NXT_OK;
 }
 
-if (value->type == NJS_STRING
+if (njs_is_string(value)
 && value->data.string_size == lhq->key.length
 && memcmp(value->data.u.string->start, lhq->key.start, lhq->key.length)
== 0)
diff -r 8e20f235b71e -r dc8af19bf47d njs/njs_vm.c
--- a/njs/njs_vm.c  Fri Mar 31 14:02:38 2017 +0300
+++ b/njs/njs_vm.c  Fri Mar 31 14:05:44 2017 +0300
@@ -292,7 +292,7 @@ njs_value_retain(njs_value_t *value)
 {
 njs_string_t  *string;
 
-if (value->type == NJS_STRING) {
+if (njs_is_string(value)) {
 
 if (value->data.external0 != 0xff) {
 string = value->data.u.string;
@@ -313,7 +313,7 @@ njs_value_release(njs_vm_t *vm, njs_valu
 {
 njs_string_t  *string;
 
-if (value->type == NJS_STRING) {
+if (njs_is_string(value)) {
 
 if (value->data.external0 != 0xff) {
 string = value->data.u.string;
@@ -2071,7 +2071,7 @@ njs_values_strict_equal(const njs_value_
 
 if (njs_is_numeric(val1)) {
 
-if (val1->type == NJS_VOID) {
+if (njs_is_void(val1)) {
 return 1;
 }
 
___
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel


[njs] Style and small miscellaneous fixes.

2016-11-09 Thread Igor Sysoev
details:   http://hg.nginx.org/njs/rev/7a42d1e83ae2
branches:  
changeset: 245:7a42d1e83ae2
user:  Igor Sysoev 
date:  Wed Nov 09 15:04:40 2016 +0300
description:
Style and small miscellaneous fixes.

diffstat:

 njs/njs_disassembler.c  |   2 +-
 njs/njs_string.c|   3 +--
 njs/njs_vm.c|  14 +++---
 njs/njs_vm.h|   3 ++-
 njs/test/njs_unit_test.c|   3 ++-
 nxt/nxt_rbtree.c|  11 +++
 nxt/nxt_utf8.h  |   1 -
 nxt/test/random_unit_test.c |   2 +-
 8 files changed, 17 insertions(+), 22 deletions(-)

diffs (157 lines):

diff -r c8862eb2eb94 -r 7a42d1e83ae2 njs/njs_disassembler.c
--- a/njs/njs_disassembler.cWed Nov 09 14:34:32 2016 +0300
+++ b/njs/njs_disassembler.cWed Nov 09 15:04:40 2016 +0300
@@ -151,7 +151,7 @@ njs_disassembler(njs_vm_t *vm)
 code = vm->code->start;
 n = vm->code->items;
 
-while(n != 0) {
+while (n != 0) {
 njs_disassemble(code->start, code->end);
 code++;
 n--;
diff -r c8862eb2eb94 -r 7a42d1e83ae2 njs/njs_string.c
--- a/njs/njs_string.c  Wed Nov 09 14:34:32 2016 +0300
+++ b/njs/njs_string.c  Wed Nov 09 15:04:40 2016 +0300
@@ -607,7 +607,6 @@ njs_string_prototype_concat(njs_vm_t *vm
 }
 
 for (i = 0; i < nargs; i++) {
-
 if (!njs_is_string([i])) {
 vm->frame->trap_scratch.data.u.value = [i];
 
@@ -3210,7 +3209,7 @@ static const njs_object_prop_t  njs_stri
 .type = NJS_METHOD,
 .name = njs_string("match"),
 .value = njs_native_function(njs_string_prototype_match, 0,
- NJS_STRING_ARG, NJS_REGEXP_ARG),
+ NJS_STRING_OBJECT_ARG, NJS_REGEXP_ARG),
 },
 
 {
diff -r c8862eb2eb94 -r 7a42d1e83ae2 njs/njs_vm.c
--- a/njs/njs_vm.c  Wed Nov 09 14:34:32 2016 +0300
+++ b/njs/njs_vm.c  Wed Nov 09 15:04:40 2016 +0300
@@ -79,10 +79,10 @@ static njs_ret_t njs_object_property_que
 static njs_ret_t njs_method_private_copy(njs_vm_t *vm,
 njs_property_query_t *pq);
 static nxt_noinline uint32_t njs_integer_value(double num);
-static nxt_noinline njs_ret_t njs_values_equal(njs_value_t *val1,
-njs_value_t *val2);
-static nxt_noinline njs_ret_t njs_values_compare(njs_value_t *val1,
-njs_value_t *val2);
+static nxt_noinline njs_ret_t njs_values_equal(const njs_value_t *val1,
+const njs_value_t *val2);
+static nxt_noinline njs_ret_t njs_values_compare(const njs_value_t *val1,
+const njs_value_t *val2);
 static njs_object_t *njs_function_new_object(njs_vm_t *vm, njs_value_t *value);
 static njs_ret_t njs_vmcode_method_call(njs_vm_t *vm, njs_value_t *object,
 njs_value_t *value);
@@ -1879,7 +1879,7 @@ njs_vmcode_not_equal(njs_vm_t *vm, njs_v
 
 
 static nxt_noinline njs_ret_t
-njs_values_equal(njs_value_t *val1, njs_value_t *val2)
+njs_values_equal(const njs_value_t *val1, const njs_value_t *val2)
 {
 /* Void and null are equal and not comparable with anything else. */
 if (njs_is_null_or_void(val1)) {
@@ -1967,7 +1967,7 @@ njs_vmcode_greater_or_equal(njs_vm_t *vm
  */
 
 static nxt_noinline njs_ret_t
-njs_values_compare(njs_value_t *val1, njs_value_t *val2)
+njs_values_compare(const njs_value_t *val1, const njs_value_t *val2)
 {
 if (nxt_fast_path(njs_is_numeric(val1) || njs_is_numeric(val2))) {
 
@@ -2030,7 +2030,7 @@ njs_vmcode_strict_not_equal(njs_vm_t *vm
 
 
 nxt_noinline nxt_bool_t
-njs_values_strict_equal(njs_value_t *val1, njs_value_t *val2)
+njs_values_strict_equal(const njs_value_t *val1, const njs_value_t *val2)
 {
 size_tsize;
 const u_char  *start1, *start2;
diff -r c8862eb2eb94 -r 7a42d1e83ae2 njs/njs_vm.h
--- a/njs/njs_vm.h  Wed Nov 09 14:34:32 2016 +0300
+++ b/njs/njs_vm.h  Wed Nov 09 15:04:40 2016 +0300
@@ -1007,7 +1007,8 @@ njs_ret_t njs_vmcode_catch(njs_vm_t *vm,
 njs_ret_t njs_vmcode_finally(njs_vm_t *vm, njs_value_t *invld,
 njs_value_t *retval);
 
-nxt_bool_t njs_values_strict_equal(njs_value_t *val1, njs_value_t *val2);
+nxt_bool_t njs_values_strict_equal(const njs_value_t *val1,
+const njs_value_t *val2);
 
 njs_ret_t njs_normalize_args(njs_vm_t *vm, njs_value_t *args,
 uint8_t *args_types, nxt_uint_t nargs);
diff -r c8862eb2eb94 -r 7a42d1e83ae2 njs/test/njs_unit_test.c
--- a/njs/test/njs_unit_test.c  Wed Nov 09 14:34:32 2016 +0300
+++ b/njs/test/njs_unit_test.c  Wed Nov 09 15:04:40 2016 +0300
@@ -6218,10 +6218,11 @@ main(int argc, char **argv)
 "fibo(32).length");
 
 static nxt_str_t  fibo_bytes = nxt_string(
+"var a = '\\x80'.toBytes();"
 "function fibo(n) {"
 "if (n > 1)"
 "return fibo(n - 1) + fibo(n - 2)"
-"return '\\x80'.toBytes()"
+"return a"
 "}"
 "fibo(32).length");
 
diff -r c8862eb2eb94 -r 7a42d1e83ae2 nxt/nxt_rbtree.c
--- a/nxt/nxt_rbtree.c  Wed Nov 09 14:34:32 2016 +0300
+++ b/nxt/nxt_rbtree.c  Wed Nov 09 15:04:40 2016 +0300
@@ -17,7 +17,8 @@
 
 
 

[njs] Style unification of configure feature tests.

2016-10-24 Thread Igor Sysoev
details:   http://hg.nginx.org/njs/rev/0fe25989e0a6
branches:  
changeset: 218:0fe25989e0a6
user:  Igor Sysoev 
date:  Mon Oct 24 17:29:27 2016 +0300
description:
Style unification of configure feature tests.

diffstat:

 nxt/auto/clang |  10 +-
 nxt/auto/getrandom |   2 +-
 nxt/auto/time  |   4 ++--
 3 files changed, 8 insertions(+), 8 deletions(-)

diffs (76 lines):

diff -r eef409d1d4be -r 0fe25989e0a6 nxt/auto/clang
--- a/nxt/auto/clangMon Oct 24 17:23:00 2016 +0300
+++ b/nxt/auto/clangMon Oct 24 17:29:27 2016 +0300
@@ -205,20 +205,20 @@ nxt_feature_test="int main(void) {
 
 nxt_feature="GCC __attribute__ visibility"
 nxt_feature_name=NXT_HAVE_GCC_ATTRIBUTE_VISIBILITY
-nxt_feature_run=
+nxt_feature_run=no
 nxt_feature_path=
 nxt_feature_libs=
 nxt_feature_test="int n __attribute__ ((visibility(\"default\")));
 
   int main(void) {
-  return 1;
+  return 0;
   }"
 . ${NXT_AUTO}feature
 
 
 nxt_feature="GCC __attribute__ malloc"
 nxt_feature_name=NXT_HAVE_GCC_ATTRIBUTE_MALLOC
-nxt_feature_run=
+nxt_feature_run=no
 nxt_feature_path=
 nxt_feature_libs=
 nxt_feature_test="#include 
@@ -251,13 +251,13 @@ else
 
 nxt_feature="GCC __attribute__ aligned"
 nxt_feature_name=NXT_HAVE_GCC_ATTRIBUTE_ALIGNED
-nxt_feature_run=
+nxt_feature_run=no
 nxt_feature_path=
 nxt_feature_libs=
 nxt_feature_test="int n __attribute__ ((aligned(64)));
 
   int main(void) {
-  return 1;
+  return 0;
   }"
 . ${NXT_AUTO}feature
 
diff -r eef409d1d4be -r 0fe25989e0a6 nxt/auto/getrandom
--- a/nxt/auto/getrandomMon Oct 24 17:23:00 2016 +0300
+++ b/nxt/auto/getrandomMon Oct 24 17:29:27 2016 +0300
@@ -7,7 +7,7 @@
 
 nxt_feature="getrandom()"
 nxt_feature_name=NXT_HAVE_GETRANDOM
-nxt_feature_run=
+nxt_feature_run=no
 nxt_feature_incs=
 nxt_feature_libs=
 nxt_feature_test="#include 
diff -r eef409d1d4be -r 0fe25989e0a6 nxt/auto/time
--- a/nxt/auto/time Mon Oct 24 17:23:00 2016 +0300
+++ b/nxt/auto/time Mon Oct 24 17:29:27 2016 +0300
@@ -7,7 +7,7 @@
 
 nxt_feature="struct tm.tm_gmtoff"
 nxt_feature_name=NXT_HAVE_TM_GMTOFF
-nxt_feature_run=
+nxt_feature_run=no
 nxt_feature_incs=
 nxt_feature_libs=
 nxt_feature_test="#include 
@@ -27,7 +27,7 @@ nxt_feature_test="#include 
 
 nxt_feature="altzone"
 nxt_feature_name=NXT_HAVE_ALTZONE
-nxt_feature_run=
+nxt_feature_run=no
 nxt_feature_incs=
 nxt_feature_libs=
 nxt_feature_test="#include 

___
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel


[njs] Style fixes.

2016-10-17 Thread Igor Sysoev
details:   http://hg.nginx.org/njs/rev/6fc0e6b7f797
branches:  
changeset: 203:6fc0e6b7f797
user:  Igor Sysoev 
date:  Mon Oct 17 17:03:22 2016 +0300
description:
Style fixes.

diffstat:

 njs/njs_array.c  |   2 ++
 njs/njs_string.c |  38 +++---
 2 files changed, 21 insertions(+), 19 deletions(-)

diffs (80 lines):

diff -r 938d49b0f420 -r 6fc0e6b7f797 njs/njs_array.c
--- a/njs/njs_array.c   Mon Oct 17 16:42:31 2016 +0300
+++ b/njs/njs_array.c   Mon Oct 17 17:03:22 2016 +0300
@@ -759,6 +759,7 @@ njs_array_prototype_join(njs_vm_t *vm, n
 
 for (i = 0; i < array->length; i++) {
 value = >start[i];
+
 if (!njs_is_string(value)
 && njs_is_valid(value)
 && !njs_is_null_or_void(value))
@@ -783,6 +784,7 @@ njs_array_prototype_join(njs_vm_t *vm, n
 
 for (i = 0; i < array->length; i++) {
 value = >start[i];
+
 if (!njs_is_string(value)
 && njs_is_valid(value)
 && !njs_is_null_or_void(value))
diff -r 938d49b0f420 -r 6fc0e6b7f797 njs/njs_string.c
--- a/njs/njs_string.c  Mon Oct 17 16:42:31 2016 +0300
+++ b/njs/njs_string.c  Mon Oct 17 17:03:22 2016 +0300
@@ -1018,7 +1018,7 @@ static nxt_noinline void
 njs_string_slice_args(njs_slice_prop_t *slice, njs_value_t *args,
 nxt_uint_t nargs)
 {
-ssize_tstart, end, length;
+ssize_t  start, end, length;
 
 length = slice->string_length;
 start = 0;
@@ -1079,30 +1079,30 @@ njs_string_slice(njs_vm_t *vm, njs_value
 start = string->start;
 
 if (string->size == slice->string_length) {
-   /* Byte or ASCII string. */
-   start += slice->start;
-   size = slice->length;
+/* Byte or ASCII string. */
+start += slice->start;
+size = slice->length;
 
 } else {
-   /* UTF-8 string. */
+/* UTF-8 string. */
 end = start + string->size;
-   start = njs_string_offset(start, end, slice->start);
-
-   /* Evaluate size of the slice in bytes and ajdust length. */
-   p = start;
-   n = length;
-
-   do {
-   p = nxt_utf8_next(p, end);
-   n--;
-   } while (n != 0 && p < end);
-
-   size = p - start;
-   length -= n;
+start = njs_string_offset(start, end, slice->start);
+
+/* Evaluate size of the slice in bytes and ajdust length. */
+p = start;
+n = length;
+
+do {
+p = nxt_utf8_next(p, end);
+n--;
+} while (n != 0 && p < end);
+
+size = p - start;
+length -= n;
 }
 
 if (nxt_fast_path(size != 0)) {
-   return njs_string_new(vm, >retval, start, size, length);
+return njs_string_new(vm, >retval, start, size, length);
 }
 
 vm->retval = njs_string_empty;

___
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel


[njs] Style: express requirement to use PCRE via $ngx_module_libs.

2016-09-15 Thread Ruslan Ermilov
details:   http://hg.nginx.org/njs/rev/1745fcf4a5cc
branches:  
changeset: 173:1745fcf4a5cc
user:  Ruslan Ermilov 
date:  Thu Sep 15 10:52:01 2016 +0300
description:
Style: express requirement to use PCRE via $ngx_module_libs.

diffstat:

 nginx/config |  8 
 1 files changed, 4 insertions(+), 4 deletions(-)

diffs (32 lines):

diff -r efd2f95aaeb4 -r 1745fcf4a5cc nginx/config
--- a/nginx/config  Tue Sep 13 16:59:27 2016 +0300
+++ b/nginx/config  Thu Sep 15 10:52:01 2016 +0300
@@ -1,13 +1,11 @@
 ngx_addon_name="ngx_js_module"
 
-USE_PCRE=YES
-
 if test -n "$ngx_module_link"; then
 ngx_module_type=HTTP
 ngx_module_name=ngx_http_js_module
 ngx_module_incs="$ngx_addon_dir/../nxt $ngx_addon_dir/../njs"
 ngx_module_srcs="$ngx_addon_dir/ngx_http_js_module.c"
-ngx_module_libs="$ngx_addon_dir/../build/libnjs.a -lm"
+ngx_module_libs="PCRE $ngx_addon_dir/../build/libnjs.a -lm"
 
 . auto/module
 
@@ -15,10 +13,12 @@ if test -n "$ngx_module_link"; then
 ngx_module_name=ngx_stream_js_module
 ngx_module_incs="$ngx_addon_dir/../nxt $ngx_addon_dir/../njs"
 ngx_module_srcs="$ngx_addon_dir/ngx_stream_js_module.c"
-ngx_module_libs="$ngx_addon_dir/../build/libnjs.a -lm"
+ngx_module_libs="PCRE $ngx_addon_dir/../build/libnjs.a -lm"
 
 . auto/module
 else
+USE_PCRE=YES
+
 HTTP_MODULES="$HTTP_MODULES ngx_http_js_module"
 STREAM_MODULES="$STREAM_MODULES ngx_stream_js_module"
 CORE_INCS="$CORE_INCS $ngx_addon_dir/../nxt $ngx_addon_dir/../njs"

___
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel


[njs] Style fixes.

2016-08-16 Thread Igor Sysoev
details:   http://hg.nginx.org/njs/rev/dcd8a105b5e7
branches:  
changeset: 156:dcd8a105b5e7
user:  Igor Sysoev 
date:  Tue Aug 16 18:09:35 2016 +0300
description:
Style fixes.

diffstat:

 njs/njs_array.c  |  84 +++
 njs/njs_string.c |  20 ++
 njs/njs_vm.h |   2 +-
 nxt/nxt_djb_hash.h   |   2 +-
 nxt/nxt_lvlhsh.c |  46 +-
 nxt/nxt_lvlhsh.h |  36 ++--
 nxt/nxt_mem_cache_pool.c |   6 +-
 nxt/nxt_rbtree.c |   2 +-
 nxt/nxt_rbtree.h |   4 +-
 9 files changed, 102 insertions(+), 100 deletions(-)

diffs (606 lines):

diff -r e6e192a55774 -r dcd8a105b5e7 njs/njs_array.c
--- a/njs/njs_array.c   Mon Aug 15 11:33:37 2016 +0300
+++ b/njs/njs_array.c   Tue Aug 16 18:09:35 2016 +0300
@@ -79,28 +79,26 @@ typedef struct {
 } njs_array_sort_t;
 
 
-static njs_ret_t
-njs_array_prototype_to_string_continuation(njs_vm_t *vm, njs_value_t *args,
-nxt_uint_t nargs, njs_index_t retval);
+static njs_ret_t njs_array_prototype_to_string_continuation(njs_vm_t *vm,
+njs_value_t *args, nxt_uint_t nargs, njs_index_t retval);
 static njs_ret_t njs_array_prototype_join_continuation(njs_vm_t *vm,
 njs_value_t *args, nxt_uint_t nargs, njs_index_t unused);
-static nxt_noinline njs_value_t *njs_array_copy(njs_value_t *dst,
-njs_value_t *src);
+static njs_value_t *njs_array_copy(njs_value_t *dst, njs_value_t *src);
 static njs_ret_t njs_array_index_of(njs_vm_t *vm, njs_value_t *args,
 nxt_uint_t nargs, nxt_bool_t first);
-static nxt_noinline njs_ret_t njs_array_prototype_for_each_cont(njs_vm_t *vm,
-njs_value_t *args, nxt_uint_t nargs, njs_index_t unused);
-static nxt_noinline njs_ret_t njs_array_prototype_some_cont(njs_vm_t *vm,
-njs_value_t *args, nxt_uint_t nargs, njs_index_t unused);
-static nxt_noinline njs_ret_t njs_array_prototype_every_cont(njs_vm_t *vm,
+static njs_ret_t njs_array_prototype_for_each_continuation(njs_vm_t *vm,
 njs_value_t *args, nxt_uint_t nargs, njs_index_t unused);
-static njs_ret_t njs_array_prototype_filter_cont(njs_vm_t *vm,
+static njs_ret_t njs_array_prototype_some_continuation(njs_vm_t *vm,
 njs_value_t *args, nxt_uint_t nargs, njs_index_t unused);
-static njs_ret_t njs_array_prototype_map_cont(njs_vm_t *vm, njs_value_t *args,
-nxt_uint_t nargs, njs_index_t unused);
-static njs_ret_t njs_array_prototype_reduce_cont(njs_vm_t *vm,
+static njs_ret_t njs_array_prototype_every_continuation(njs_vm_t *vm,
 njs_value_t *args, nxt_uint_t nargs, njs_index_t unused);
-static njs_ret_t njs_array_prototype_reduce_right_cont(njs_vm_t *vm,
+static njs_ret_t njs_array_prototype_filter_continuation(njs_vm_t *vm,
+njs_value_t *args, nxt_uint_t nargs, njs_index_t unused);
+static njs_ret_t njs_array_prototype_map_continuation(njs_vm_t *vm,
+njs_value_t *args, nxt_uint_t nargs, njs_index_t unused);
+static njs_ret_t njs_array_prototype_reduce_continuation(njs_vm_t *vm,
+njs_value_t *args, nxt_uint_t nargs, njs_index_t unused);
+static njs_ret_t njs_array_prototype_reduce_right_continuation(njs_vm_t *vm,
 njs_value_t *args, nxt_uint_t nargs, njs_index_t unused);
 static nxt_noinline njs_ret_t njs_array_iterator_args(njs_vm_t *vm,
 njs_value_t *args, nxt_uint_t nargs);
@@ -109,8 +107,8 @@ static nxt_noinline uint32_t njs_array_i
 static nxt_noinline njs_ret_t njs_array_iterator_apply(njs_vm_t *vm,
 njs_array_iter_t *iter, njs_value_t *args, nxt_uint_t nargs);
 static uint32_t njs_array_reduce_right_next(njs_array_t *array, int32_t n);
-static njs_ret_t njs_array_prototype_sort_cont(njs_vm_t *vm, njs_value_t *args,
-nxt_uint_t nargs, njs_index_t unused);
+static njs_ret_t njs_array_prototype_sort_continuation(njs_vm_t *vm,
+njs_value_t *args, nxt_uint_t nargs, njs_index_t unused);
 
 
 nxt_noinline njs_array_t *
@@ -932,7 +930,7 @@ njs_array_prototype_concat(njs_vm_t *vm,
 }
 
 
-static nxt_noinline njs_value_t *
+static njs_value_t *
 njs_array_copy(njs_value_t *dst, njs_value_t *src)
 {
 nxt_uint_t  n;
@@ -1031,14 +1029,14 @@ njs_array_prototype_for_each(njs_vm_t *v
 }
 
 iter = njs_continuation(vm->frame);
-iter->u.cont.function = njs_array_prototype_for_each_cont;
+iter->u.cont.function = njs_array_prototype_for_each_continuation;
 
-return njs_array_prototype_for_each_cont(vm, args, nargs, unused);
+return njs_array_prototype_for_each_continuation(vm, args, nargs, unused);
 }
 
 
 static njs_ret_t
-njs_array_prototype_for_each_cont(njs_vm_t *vm, njs_value_t *args,
+njs_array_prototype_for_each_continuation(njs_vm_t *vm, njs_value_t *args,
 nxt_uint_t nargs, njs_index_t unused)
 {
 njs_array_iter_t  *iter;
@@ -1067,15 +1065,15 @@ njs_array_prototype_some(njs_vm_t *vm, n
 }
 
 iter = njs_continuation(vm->frame);
-iter->u.cont.function = njs_array_prototype_some_cont;
+iter->u.cont.function = 

[njs] Style and small miscellaneous fixes.

2016-03-24 Thread Igor Sysoev
details:   http://hg.nginx.org/njs/rev/5995bd7637ff
branches:  
changeset: 85:5995bd7637ff
user:  Igor Sysoev 
date:  Wed Mar 23 15:27:10 2016 +0300
description:
Style and small miscellaneous fixes.

diffstat:

 njs/njs_string.c|   6 ++
 njs/njs_string.h|   2 +-
 njs/njs_vm.c|   1 -
 njs/njs_vm.h|   5 -
 njs/test/njs_unit_test.c|  15 +++
 nxt/test/lvlhsh_unit_test.c |  10 +-
 nxt/test/rbtree_unit_test.c |   6 +++---
 nxt/test/utf8_unit_test.c   |  10 +-
 8 files changed, 39 insertions(+), 16 deletions(-)

diffs (196 lines):

diff -r 4deb6b538b48 -r 5995bd7637ff njs/njs_string.c
--- a/njs/njs_string.c  Wed Mar 23 12:10:44 2016 +0300
+++ b/njs/njs_string.c  Wed Mar 23 15:27:10 2016 +0300
@@ -547,6 +547,7 @@ njs_string_prototype_concat(njs_vm_t *vm
 
 /*
  * String.fromUTF8(start[, end]).
+ * The method converts an UTF-8 encoded byte string to an Unicode string.
  */
 
 static njs_ret_t
@@ -599,6 +600,7 @@ njs_string_prototype_from_utf8(njs_vm_t 
 
 /*
  * String.toUTF8(start[, end]).
+ * The method serializes Unicode string to an UTF-8 encoded byte string.
  */
 
 static njs_ret_t
@@ -621,6 +623,7 @@ njs_string_prototype_to_utf8(njs_vm_t *v
 
 /*
  * String.fromBytes(start[, end]).
+ * The method converts a byte string to an Unicode string.
  */
 
 static njs_ret_t
@@ -676,6 +679,9 @@ njs_string_prototype_from_bytes(njs_vm_t
 
 /*
  * String.toBytes(start[, end]).
+ * The method serializes an Unicode string to a byte string.
+ * The method returns null if a character larger than 255 is
+ * encountered in the Unicode string.
  */
 
 static njs_ret_t
diff -r 4deb6b538b48 -r 5995bd7637ff njs/njs_string.h
--- a/njs/njs_string.h  Wed Mar 23 12:10:44 2016 +0300
+++ b/njs/njs_string.h  Wed Mar 23 15:27:10 2016 +0300
@@ -55,7 +55,7 @@
  * 3) if the length is less than NJS_STRING_MAP_OFFSET.
  *
  * The current implementation does not support Unicode surrogate pairs.
- * If offset in map points to surrogate pair, it the previous offset
+ * If offset in map points to surrogate pair then the previous offset
  * should be used and so on until start of the string.
  */
 
diff -r 4deb6b538b48 -r 5995bd7637ff njs/njs_vm.c
--- a/njs/njs_vm.c  Wed Mar 23 12:10:44 2016 +0300
+++ b/njs/njs_vm.c  Wed Mar 23 15:27:10 2016 +0300
@@ -133,7 +133,6 @@ const njs_value_t  njs_string_nan = 
 const njs_value_t  njs_string_string =  njs_string("string");
 const njs_value_t  njs_string_object =  njs_string("object");
 const njs_value_t  njs_string_function =njs_string("function");
-const njs_value_t  njs_string_native =  njs_string("[native code]");
 
 const njs_value_t  njs_exception_syntax_error =njs_string("SyntaxError");
 const njs_value_t  njs_exception_reference_error = 
njs_string("ReferenceError");
diff -r 4deb6b538b48 -r 5995bd7637ff njs/njs_vm.h
--- a/njs/njs_vm.h  Wed Mar 23 12:10:44 2016 +0300
+++ b/njs/njs_vm.h  Wed Mar 23 15:27:10 2016 +0300
@@ -41,7 +41,10 @@
 #define NJS_APPLIED  NXT_DONE
 
 
-/* The order of the enum is used in njs_vmcode_typeof() */
+/*
+ * The order of the enum is used in njs_vmcode_typeof()
+ * and njs_object_prototype_to_string().
+ */
 
 typedef enum {
 NJS_NULL= 0x00,
diff -r 4deb6b538b48 -r 5995bd7637ff njs/test/njs_unit_test.c
--- a/njs/test/njs_unit_test.c  Wed Mar 23 12:10:44 2016 +0300
+++ b/njs/test/njs_unit_test.c  Wed Mar 23 15:27:10 2016 +0300
@@ -404,6 +404,15 @@ static njs_unit_test_t  njs_test[] =
 { nxt_string("'3' -+-+-+ '1' + '1' / '3' * '6' + '2'"),
   nxt_string("42") },
 
+{ nxt_string("((+!![])+(+!![])+(+!![])+(+!![])+[])+((+!![])+(+!![])+[])"),
+  nxt_string("42") },
+
+{ nxt_string("1+[[]+[]]-[]+[[]-[]]-1"),
+  nxt_string("9") },
+
+{ nxt_string("[[]+[]]-[]+[[]-[]]"),
+  nxt_string("00") },
+
 { nxt_string("'true' == true"),
   nxt_string("false") },
 
@@ -3796,6 +3805,9 @@ static njs_unit_test_t  njs_test[] =
 { nxt_string("Function.constructor === Function"),
   nxt_string("true") },
 
+{ nxt_string("function f() {} f.__proto__ === Function.prototype"),
+  nxt_string("true") },
+
 { nxt_string("RegExp()"),
   nxt_string("/(?:)/") },
 
@@ -3823,6 +3835,9 @@ static njs_unit_test_t  njs_test[] =
 { nxt_string("RegExp.constructor === Function"),
   nxt_string("true") },
 
+{ nxt_string("/./.__proto__ === RegExp.prototype"),
+  nxt_string("true") },
+
 { nxt_string("Object.prototype.toString.call()"),
   nxt_string("[object Undefined]") },
 
diff -r 4deb6b538b48 -r 5995bd7637ff nxt/test/lvlhsh_unit_test.c
--- a/nxt/test/lvlhsh_unit_test.c   Wed Mar 23 12:10:44 2016 +0300
+++ b/nxt/test/lvlhsh_unit_test.c   Wed Mar 23 15:27:10 2016 +0300
@@ -193,16 +193,16 @@ static const nxt_mem_proto_t  mem_cache_
 static nxt_int_t
 lvlhsh_unit_test(nxt_uint_t n)
 {
-uintptr_tkey;
+uintptr_t