[njs] Style.

Dmitry Volyntsev xeioex at nginx.com
Fri Sep 6 12:47:38 UTC 2019


details:   https://hg.nginx.org/njs/rev/12da61ec4adb
branches:  
changeset: 1157:12da61ec4adb
user:      Dmitry Volyntsev <xeioex at nginx.com>
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.c	Tue Sep 03 17:31:45 2019 +0300
+++ b/src/njs_dtoa.c	Fri 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_t    len;
@@ -297,7 +297,7 @@ njs_prettify(char *start, size_t len, in
         memmove(&start[kk + 1], &start[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(&start[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, &start[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, &start[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.h	Tue Sep 03 17:31:45 2019 +0300
+++ b/src/njs_dtoa.h	Fri 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)
 {
-    char        c;
-    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_t    ret;
     njs_str_t    source, script;
     struct stat  sb;
+    u_char       buf[4096];
 
     file = opts->file;
 


More information about the nginx-devel mailing list