]> git.kaiwu.me - njs.git/commitdiff
Miscellaneous changes.
authorIgor Sysoev <igor@sysoev.ru>
Tue, 21 Mar 2017 13:14:16 +0000 (16:14 +0300)
committerIgor Sysoev <igor@sysoev.ru>
Tue, 21 Mar 2017 13:14:16 +0000 (16:14 +0300)
njs/njs_array.c
nxt/test/rbtree_unit_test.c

index 2361c4f8c995bcbb72825c4e260bf7fe619fe0a4..dfd9ac44c4be41ca4bcea040af63b2fdba657fdb 100644 (file)
@@ -1295,7 +1295,7 @@ static njs_ret_t
 njs_array_prototype_fill(njs_vm_t *vm, njs_value_t *args, nxt_uint_t nargs,
     njs_index_t unused)
 {
-    nxt_int_t    start, end, length;
+    nxt_int_t    i, start, end, length;
     njs_array_t  *array;
 
     vm->retval = args[0];
@@ -1346,8 +1346,8 @@ njs_array_prototype_fill(njs_vm_t *vm, njs_value_t *args, nxt_uint_t nargs,
        }
     }
 
-    while (start < end) {
-        array->start[start++] = args[1];
+    for (i = start; i < end; i++) {
+        array->start[i] = args[1];
     }
 
     return NXT_OK;
index e2766a7369a1f07117dfb20695a06b87810c1680..c1347bfb4980673490832485bf02b967513f725d 100644 (file)
@@ -51,7 +51,7 @@ rbtree_unit_test(nxt_uint_t n)
 
     keys = malloc(n * sizeof(uint32_t));
     if (keys == NULL) {
-        free(keys);
+        free(items);
         return NXT_ERROR;
     }