jv_aux.c: replace jv_array_foreach with regular loop in jv_dels()
The code was only conditionally using the value
This commit is contained in:
1 parent
ea78b5a030
commit
ce2638af40
1 file changed
+2
-4
+2
-4
@@ -314,7 +314,7 @@ static jv jv_dels(jv t, jv keys) {
|
|||||||
int neg_idx = 0;
|
int neg_idx = 0;
|
||||||
int nonneg_idx = 0;
|
int nonneg_idx = 0;
|
||||||
int len = jv_array_length(jv_copy(t));
|
int len = jv_array_length(jv_copy(t));
|
||||||
jv_array_foreach(t, i, elem) {
|
for (int i = 0; i < len; ++i) {
|
||||||
int del = 0;
|
int del = 0;
|
||||||
while (neg_idx < jv_array_length(jv_copy(neg_keys))) {
|
while (neg_idx < jv_array_length(jv_copy(neg_keys))) {
|
||||||
int delidx = len + (int)jv_number_get_value_and_consume(jv_array_get(jv_copy(neg_keys), neg_idx));
|
int delidx = len + (int)jv_number_get_value_and_consume(jv_array_get(jv_copy(neg_keys), neg_idx));
|
||||||
@@ -343,9 +343,7 @@ static jv jv_dels(jv t, jv keys) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!del)
|
if (!del)
|
||||||
new_array = jv_array_append(new_array, elem);
|
new_array = jv_array_append(new_array, jv_array_get(jv_copy(t), i));
|
||||||
else
|
|
||||||
jv_free(elem);
|
|
||||||
}
|
}
|
||||||
arr_out:
|
arr_out:
|
||||||
jv_free(neg_keys);
|
jv_free(neg_keys);
|
||||||
|
|||||||
Reference in new issue
Block a user