[njs] Style fixes and small miscellaneous changes.

Igor Sysoev igor at sysoev.ru
Tue Jun 27 11:19:33 UTC 2017


details:   http://hg.nginx.org/njs/rev/30cc8990272a
branches:  
changeset: 378:30cc8990272a
user:      Igor Sysoev <igor at sysoev.ru>
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.c	Fri Jun 23 15:49:09 2017 +0300
+++ b/nginx/ngx_http_js_module.c	Tue 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.c	Fri Jun 23 15:49:09 2017 +0300
+++ b/njs/njs_date.c	Tue 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(&p, 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 ? &njs_string_true :
-                                                 &njs_string_false;
+    retval = args[1].data.u.object->extensible ? &njs_string_true
+                                               : &njs_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)
 {
-    int                captures[2];
-    u_char             *p, *end;
-    size_t             size;
-    njs_ret_t          ret;
-    nxt_str_t          search;
+    int        captures[2];
+    u_char     *p, *end;
+    size_t     size;
+    njs_ret_t  ret;
+    nxt_str_t  search;
 
     njs_string_get(&args[1], &search);
 
@@ -2908,7 +2908,7 @@ njs_ret_t
 njs_primitive_value_to_string(njs_vm_t *vm, njs_value_t *dst,
     const njs_value_t *src)
 {
-    const njs_value_t   *value;
+    const njs_value_t  *value;
 
     switch (src->type) {
 
@@ -2945,10 +2945,10 @@ njs_primitive_value_to_string(njs_vm_t *
 double
 njs_string_to_number(njs_value_t *value, nxt_bool_t parse_float)
 {
-    u_char        *p, *start, *end;
-    double        num;
-    size_t        size;
-    nxt_bool_t    minus;
+    u_char      *p, *start, *end;
+    double      num;
+    size_t      size;
+    nxt_bool_t  minus;
 
     const size_t  infinity = sizeof("Infinity") - 1;
 
@@ -3716,8 +3716,8 @@ njs_value_index(njs_vm_t *vm, njs_parser
         lhq.value = value;
         lhq.pool = vm->mem_cache_pool;
 
-        values_hash = parser->runtime ? &vm->values_hash:
-                                        &vm->shared->values_hash;
+        values_hash = parser->runtime ? &vm->values_hash
+                                      : &vm->shared->values_hash;
 
         ret = nxt_lvlhsh_insert(values_hash, &lhq);
 
diff -r d882561d50e8 -r 30cc8990272a nxt/nxt_lvlhsh.c
--- a/nxt/nxt_lvlhsh.c	Fri Jun 23 15:49:09 2017 +0300
+++ b/nxt/nxt_lvlhsh.c	Tue Jun 27 11:17:54 2017 +0300
@@ -848,8 +848,8 @@ nxt_lvlhsh_bucket_each(nxt_lvlhsh_each_t
     if (lhe->entries == 0) {
         next = *nxt_lvlhsh_next_bucket(lhe->proto, lhe->bucket);
 
-        lhe->bucket = (next == NULL) ? NXT_LVLHSH_BUCKET_DONE:
-                                       nxt_lvlhsh_bucket(lhe->proto, next);
+        lhe->bucket = (next == NULL) ? NXT_LVLHSH_BUCKET_DONE
+                                     : nxt_lvlhsh_bucket(lhe->proto, next);
 
         lhe->entries = nxt_lvlhsh_bucket_entries(lhe->proto, next);
         lhe->entry = 0;
diff -r d882561d50e8 -r 30cc8990272a nxt/nxt_lvlhsh.h
--- a/nxt/nxt_lvlhsh.h	Fri Jun 23 15:49:09 2017 +0300
+++ b/nxt/nxt_lvlhsh.h	Tue Jun 27 11:17:54 2017 +0300
@@ -93,7 +93,7 @@ typedef struct {
 
 
 typedef struct {
-    void                       *slot;
+    void                      *slot;
 } nxt_lvlhsh_t;
 
 
@@ -179,15 +179,7 @@ typedef struct {
         (lhe)->proto = _proto;                                                \
     } while (0)
 
-NXT_EXPORT void *nxt_lvlhsh_each(nxt_lvlhsh_t *lh, nxt_lvlhsh_each_t *le);
-
-
-NXT_EXPORT void *nxt_lvlhsh_alloc(void *data, size_t size, nxt_uint_t nalloc);
-NXT_EXPORT void nxt_lvlhsh_free(void *data, void *p, size_t size);
-
-NXT_EXPORT void *nxt_lvlhsh_pool_alloc(void *ctx, size_t size,
-    nxt_uint_t nalloc);
-NXT_EXPORT void nxt_lvlhsh_pool_free(void *ctx, void *p, size_t size);
+NXT_EXPORT void *nxt_lvlhsh_each(nxt_lvlhsh_t *lh, nxt_lvlhsh_each_t *lhe);
 
 
 #endif /* _NXT_LVLHSH_H_INCLUDED_ */
diff -r d882561d50e8 -r 30cc8990272a nxt/nxt_rbtree.c
--- a/nxt/nxt_rbtree.c	Fri Jun 23 15:49:09 2017 +0300
+++ b/nxt/nxt_rbtree.c	Tue Jun 27 11:17:54 2017 +0300
@@ -349,7 +349,6 @@ nxt_rbtree_delete_fixup(nxt_rbtree_t *tr
          * Prefetching parent nodes does not help here according
          * to microbenchmarks.
          */
-
         parent = node->parent;
 
         if (node == parent->left) {
diff -r d882561d50e8 -r 30cc8990272a nxt/nxt_utf8.c
--- a/nxt/nxt_utf8.c	Fri Jun 23 15:49:09 2017 +0300
+++ b/nxt/nxt_utf8.c	Tue Jun 27 11:17:54 2017 +0300
@@ -35,7 +35,7 @@ nxt_utf8_encode(u_char *p, uint32_t u)
 
     if (u < 0x0800) {
         *p++ = (u_char) (( u >> 6)          | 0xC0);
-        *p++ = (u_char) (( u        & 0x3f) | 0x80);
+        *p++ = (u_char) (( u        & 0x3F) | 0x80);
         return p;
     }
 


More information about the nginx-devel mailing list