[njs] Unifying return code variable name.

Dmitry Volyntsev xeioex at nginx.com
Thu Aug 1 18:01:31 UTC 2019


details:   https://hg.nginx.org/njs/rev/26802fc27c76
branches:  
changeset: 1089:26802fc27c76
user:      Dmitry Volyntsev <xeioex at nginx.com>
date:      Thu Aug 01 18:48:39 2019 +0300
description:
Unifying return code variable name.

Using "ret" everywhere.

diffstat:

 src/njs_builtin.c        |  18 +++++++++---------
 src/njs_vm.c             |   7 +++----
 src/test/njs_benchmark.c |   8 ++++----
 src/test/njs_unit_test.c |  26 +++++++++++++-------------
 4 files changed, 29 insertions(+), 30 deletions(-)

diffs (245 lines):

diff -r cd56dad88801 -r 26802fc27c76 src/njs_builtin.c
--- a/src/njs_builtin.c	Thu Aug 01 16:41:36 2019 +0300
+++ b/src/njs_builtin.c	Thu Aug 01 18:48:39 2019 +0300
@@ -1000,29 +1000,29 @@ njs_builtin_match_native_function(njs_vm
 {
     size_t                     len;
     njs_str_t                  string, middle;
-    njs_int_t                  rc;
+    njs_int_t                  ret;
     const njs_object_init_t    *obj, **p;
     const njs_object_prop_t    *prop;
     const njs_function_init_t  *fun;
 
     middle = njs_str_value(".");
 
-    rc = njs_builtin_match(njs_object_init, function, &prop, &obj);
+    ret = njs_builtin_match(njs_object_init, function, &prop, &obj);
 
-    if (rc == NJS_OK) {
+    if (ret == NJS_OK) {
         goto found;
     }
 
-    rc = njs_builtin_match(njs_prototype_init, function, &prop, &obj);
+    ret = njs_builtin_match(njs_prototype_init, function, &prop, &obj);
 
-    if (rc == NJS_OK) {
+    if (ret == NJS_OK) {
         middle = njs_str_value(".prototype.");
         goto found;
     }
 
-    rc = njs_builtin_match(njs_constructor_init, function, &prop, &obj);
+    ret = njs_builtin_match(njs_constructor_init, function, &prop, &obj);
 
-    if (rc == NJS_OK) {
+    if (ret == NJS_OK) {
         goto found;
     }
 
@@ -1036,9 +1036,9 @@ njs_builtin_match_native_function(njs_vm
         }
     }
 
-    rc = njs_builtin_match(njs_module_init, function, &prop, &obj);
+    ret = njs_builtin_match(njs_module_init, function, &prop, &obj);
 
-    if (rc == NJS_OK) {
+    if (ret == NJS_OK) {
         goto found;
     }
 
diff -r cd56dad88801 -r 26802fc27c76 src/njs_vm.c
--- a/src/njs_vm.c	Thu Aug 01 16:41:36 2019 +0300
+++ b/src/njs_vm.c	Thu Aug 01 18:48:39 2019 +0300
@@ -946,7 +946,6 @@ njs_vm_object_alloc(njs_vm_t *vm, njs_va
 {
     va_list             args;
     njs_int_t           ret;
-    njs_int_t           rc;
     njs_value_t         *name, *value;
     njs_object_t        *object;
     njs_object_prop_t   *prop;
@@ -957,7 +956,7 @@ njs_vm_object_alloc(njs_vm_t *vm, njs_va
         return NJS_ERROR;
     }
 
-    rc = NJS_ERROR;
+    ret = NJS_ERROR;
 
     va_start(args, retval);
 
@@ -999,7 +998,7 @@ njs_vm_object_alloc(njs_vm_t *vm, njs_va
         }
     }
 
-    rc = NJS_OK;
+    ret = NJS_OK;
 
     njs_set_object(retval, object);
 
@@ -1007,7 +1006,7 @@ done:
 
     va_end(args);
 
-    return rc;
+    return ret;
 }
 
 
diff -r cd56dad88801 -r 26802fc27c76 src/test/njs_benchmark.c
--- a/src/test/njs_benchmark.c	Thu Aug 01 16:41:36 2019 +0300
+++ b/src/test/njs_benchmark.c	Thu Aug 01 18:48:39 2019 +0300
@@ -19,7 +19,7 @@ njs_unit_test_benchmark(njs_str_t *scrip
     u_char         *start;
     njs_vm_t       *vm, *nvm;
     uint64_t       us;
-    njs_int_t      ret, rc;
+    njs_int_t      ret;
     njs_str_t      s;
     njs_uint_t     i;
     njs_bool_t     success;
@@ -30,7 +30,7 @@ njs_unit_test_benchmark(njs_str_t *scrip
 
     vm = NULL;
     nvm = NULL;
-    rc = NJS_ERROR;
+    ret = NJS_ERROR;
 
     vm = njs_vm_create(&options);
     if (vm == NULL) {
@@ -85,7 +85,7 @@ njs_unit_test_benchmark(njs_str_t *scrip
                    msg, (double) us / n, (int) ((uint64_t) n * 1000000 / us));
     }
 
-    rc = NJS_OK;
+    ret = NJS_OK;
 
 done:
 
@@ -97,7 +97,7 @@ done:
         njs_vm_destroy(vm);
     }
 
-    return rc;
+    return ret;
 }
 
 
diff -r cd56dad88801 -r 26802fc27c76 src/test/njs_unit_test.c
--- a/src/test/njs_unit_test.c	Thu Aug 01 16:41:36 2019 +0300
+++ b/src/test/njs_unit_test.c	Thu Aug 01 18:48:39 2019 +0300
@@ -14111,7 +14111,7 @@ njs_unit_test(njs_unit_test_t tests[], s
 {
     u_char        *start;
     njs_vm_t      *vm, *nvm;
-    njs_int_t     ret, rc;
+    njs_int_t     ret;
     njs_str_t     s;
     njs_uint_t    i;
     njs_stat_t    prev;
@@ -14123,7 +14123,7 @@ njs_unit_test(njs_unit_test_t tests[], s
 
     prev = *stat;
 
-    rc = NJS_ERROR;
+    ret = NJS_ERROR;
 
     for (i = 0; i < num; i++) {
 
@@ -14196,7 +14196,7 @@ njs_unit_test(njs_unit_test_t tests[], s
         vm = NULL;
     }
 
-    rc = NJS_OK;
+    ret = NJS_OK;
 
 done:
 
@@ -14210,7 +14210,7 @@ done:
 
     njs_unit_test_report(name, &prev, stat);
 
-    return rc;
+    return ret;
 }
 
 
@@ -14302,7 +14302,7 @@ static njs_int_t
 njs_vm_json_test(njs_opts_t *opts, njs_stat_t *stat)
 {
     njs_vm_t      *vm;
-    njs_int_t     ret, rc;
+    njs_int_t     ret;
     njs_str_t     s, *script;
     njs_uint_t    i;
     njs_bool_t    success;
@@ -14334,7 +14334,7 @@ njs_vm_json_test(njs_opts_t *opts, njs_s
 
     prev = *stat;
 
-    rc = NJS_ERROR;
+    ret = NJS_ERROR;
 
     for (i = 0; i < njs_nitems(tests); i++) {
 
@@ -14404,11 +14404,11 @@ njs_vm_json_test(njs_opts_t *opts, njs_s
 
     }
 
-    rc = NJS_OK;
+    ret = NJS_OK;
 
 done:
 
-    if (rc != NJS_OK) {
+    if (ret != NJS_OK) {
         if (njs_vm_retval_string(vm, &s) != NJS_OK) {
             njs_printf("njs_vm_retval_string() failed\n");
 
@@ -14423,7 +14423,7 @@ done:
         njs_vm_destroy(vm);
     }
 
-    return rc;
+    return ret;
 }
 
 
@@ -14564,7 +14564,7 @@ static njs_int_t
 njs_api_test(njs_opts_t *opts, njs_stat_t *stat)
 {
     njs_vm_t      *vm;
-    njs_int_t     ret, rc;
+    njs_int_t     ret;
     njs_uint_t    i;
     njs_stat_t    prev;
     njs_vm_opt_t  options;
@@ -14586,7 +14586,7 @@ njs_api_test(njs_opts_t *opts, njs_stat_
 
     prev = *stat;
 
-    rc = NJS_ERROR;
+    ret = NJS_ERROR;
 
     for (i = 0; i < njs_nitems(tests); i++) {
         vm = njs_vm_create(&options);
@@ -14605,7 +14605,7 @@ njs_api_test(njs_opts_t *opts, njs_stat_
         vm = NULL;
     }
 
-    rc = NJS_OK;
+    ret = NJS_OK;
 
 done:
 
@@ -14615,7 +14615,7 @@ done:
         njs_vm_destroy(vm);
     }
 
-    return rc;
+    return ret;
 }
 
 


More information about the nginx-devel mailing list