[njs] Style fixes.
Igor Sysoev
igor at sysoev.ru
Mon Oct 17 14:03:43 UTC 2016
details: http://hg.nginx.org/njs/rev/6fc0e6b7f797
branches:
changeset: 203:6fc0e6b7f797
user: Igor Sysoev <igor at sysoev.ru>
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 = &array->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 = &array->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_t start, 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, &vm->retval, start, size, length);
+ return njs_string_new(vm, &vm->retval, start, size, length);
}
vm->retval = njs_string_empty;
More information about the nginx-devel
mailing list