remove check that is always true in cx_arl_remove()

Fri, 26 Jan 2024 19:17:46 +0100

author
Mike Becker <universe@uap-core.de>
date
Fri, 26 Jan 2024 19:17:46 +0100
changeset 820
8b86ee2e09bb
parent 819
5da2ead43077
child 821
5e6f15005efd

remove check that is always true in cx_arl_remove()

src/array_list.c file | annotate | diff | comparison | revisions
     1.1 --- a/src/array_list.c	Thu Jan 25 22:05:48 2024 +0100
     1.2 +++ b/src/array_list.c	Fri Jan 26 19:17:46 2024 +0100
     1.3 @@ -327,11 +327,14 @@
     1.4              list->size - index - 1,
     1.5              &arl->reallocator
     1.6      );
     1.7 -    if (result == 0) {
     1.8 -        // decrease the size
     1.9 -        list->size--;
    1.10 -    }
    1.11 -    return result;
    1.12 +
    1.13 +    // cx_array_copy cannot fail, array cannot grow
    1.14 +    assert(result == 0);
    1.15 +
    1.16 +    // decrease the size
    1.17 +    list->size--;
    1.18 +
    1.19 +    return 0;
    1.20  }
    1.21  
    1.22  static void cx_arl_clear(struct cx_list_s *list) {

mercurial