]> git.kaiwu.me - njs.git/commitdiff
Style fixes and small miscellaneous changes.
authorIgor Sysoev <igor@sysoev.ru>
Tue, 27 Jun 2017 08:17:54 +0000 (11:17 +0300)
committerIgor Sysoev <igor@sysoev.ru>
Tue, 27 Jun 2017 08:17:54 +0000 (11:17 +0300)
nginx/ngx_http_js_module.c
njs/njs_date.c
njs/njs_number.c
njs/njs_object.c
njs/njs_string.c
nxt/nxt_lvlhsh.c
nxt/nxt_lvlhsh.h
nxt/nxt_rbtree.c
nxt/nxt_utf8.c

index 668b7192ca486771123c729671e6743c090eece6..306c5f3b955a1ddee216296b4c9b0fe9d8bb0868 100644 (file)
@@ -139,7 +139,7 @@ static ngx_command_t  ngx_http_js_commands[] = {
     { ngx_string("js_set"),
       NGX_HTTP_MAIN_CONF|NGX_CONF_TAKE2,
       ngx_http_js_set,
-      NGX_HTTP_LOC_CONF_OFFSET,
+      0,
       0,
       NULL },
 
index be3b9a12e4023917fce609c352d4b4eef56989aa..b1c4aa0d9b2f3b7601cb1a61853de334a566165d 100644 (file)
@@ -1052,8 +1052,8 @@ njs_date_prototype_to_iso_string(njs_vm_t *vm, njs_value_t *args,
         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));
index aaf539dcc5d252fd15055c6ddf7b4b8f2fb27785..a4678188fc457f5024ad339989201b0c62dc6a6a 100644 (file)
@@ -89,7 +89,7 @@ njs_number_dec_parse(u_char **start, u_char *end)
     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_char *end)
         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_char *end)
             }
         }
 
-        /* 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_char *end)
             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_char *end)
     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_value_t *args, nxt_uint_t nargs,
         n = njs_number_radix_parse(&p, end, radix);
 
         if (n >= 0) {
-            num = (minus) ? -n : n;
+            num = minus ? -n : n;
         }
     }
 
index e2d9d06c9846fd8ca7207a562f300b97e1f1cf41..d90054d9523501a01078aaadfa753b31001da14f 100644 (file)
@@ -915,8 +915,8 @@ njs_object_is_extensible(njs_vm_t *vm, njs_value_t *args, nxt_uint_t nargs,
         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;
 
index 85378194102624814093108bcbcb5cebda7ff1b0..287cba8aadbf03528204a57b8ccdf2f4899f42ff 100644 (file)
@@ -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 *vm, njs_value_t *dst,
 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_t *parser, const njs_value_t *src)
         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);
 
index 18325b712b6bcc892a67275510f1e9119352245a..6794cacb8a357f048c8d237494988e77709e6edd 100644 (file)
@@ -848,8 +848,8 @@ nxt_lvlhsh_bucket_each(nxt_lvlhsh_each_t *lhe)
     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;
index b969928ec7b31254435f1bc9020f49c2c0147762..cf6552033fa9edcea81d3aa6cd0e4a4064e4ef2a 100644 (file)
@@ -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_ */
index 390464f68ec84be1625d9cf91526fe52c217e04d..90d3a55a8ea2a2c4f229071f81ef6ca2182407e4 100644 (file)
@@ -349,7 +349,6 @@ nxt_rbtree_delete_fixup(nxt_rbtree_t *tree, nxt_rbtree_node_t *node)
          * Prefetching parent nodes does not help here according
          * to microbenchmarks.
          */
-
         parent = node->parent;
 
         if (node == parent->left) {
index b959c85e73243e8a958d543dae07fd04230699d5..d487d40a4a7f123acd9deb059df5c2b3099be95e 100644 (file)
@@ -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;
     }