diff --git a/include/array.h b/include/array.h index 4582711..cdf386e 100644 --- a/include/array.h +++ b/include/array.h @@ -18,14 +18,13 @@ extern void array_reverse(vtype_array* x) LIBCDSB_nt__ LIBCDSB_nn1__; #define array_get_by_index(s, x, index) array_get(s, x, index, 0) #define array_pop_by_index(s, x, index) array_get(s, x, index, 1) -#define array_remove_by_index(s, index) array_pop_by_index(s, nullptr, index) +#define array_remove_by_index(s, index) array_pop_by_index(s, 0, index) #define in_array(x, value) (array_indexof(x, value) >= 0) extern void* array_at (const vtype_array* s, ssize_t index); extern ssize_t array_get(vtype_array* s, vtype_value* x, ssize_t index, _Bool cut); - extern void libcdsb_array_push_pointer(vtype_array* x, const void* value) LIBCDSB_nt__ LIBCDSB_nn1__; extern void libcdsb_array_push_cstring(vtype_array* x, const char* value) LIBCDSB_nt__ LIBCDSB_nn1__; extern void libcdsb_array_push_string (vtype_array* x, const vtype_string* value) LIBCDSB_nt__ LIBCDSB_nn12__; diff --git a/src/array/extra.c b/src/array/extra.c index bfc662a..bf9027b 100644 --- a/src/array/extra.c +++ b/src/array/extra.c @@ -25,27 +25,15 @@ ssize_t array_find(const arr_t* x, const void* v, vtype vt) { assert(!is_null(x->mem)); - if (x->type != vt) { - do { - ++index; - c = vtype_compare(p, x->type, v, vt); + do { + ++index; + c = vtype_compare(p, x->type, v, vt); - if (c == 0) - return index; + if (c == 0) + return index; - p += vtype_size(x->type); - } while (p < e); - } else { - do { - ++index; - c = vtype_compare_eq(p, v, vt); - - if (c == 0) - return index; - - p += vtype_size(x->type); - } while (p < e); - } + p += vtype_size(x->type); + } while (p < e); return -1; }