src/cx/array_list.h

changeset 610
de5d3ee6435f
parent 609
6ae8146d9f62
child 612
820ee59121b4
     1.1 --- a/src/cx/array_list.h	Sun Nov 13 13:29:15 2022 +0100
     1.2 +++ b/src/cx/array_list.h	Wed Nov 16 22:27:46 2022 +0100
     1.3 @@ -89,6 +89,15 @@
     1.4  };
     1.5  
     1.6  /**
     1.7 + * Return codes for cx_array_copy().
     1.8 + */
     1.9 +enum cx_array_coppy_result {
    1.10 +    CX_ARRAY_COPY_SUCCESS,
    1.11 +    CX_ARRAY_COPY_REALLOC_NOT_SUPPORTED,
    1.12 +    CX_ARRAY_COPY_REALLOC_FAILED,
    1.13 +};
    1.14 +
    1.15 +/**
    1.16   * Copies elements from one array to another.
    1.17   *
    1.18   * The elements are copied to the \p target array at the specified \p index,
    1.19 @@ -110,9 +119,9 @@
    1.20   * @param elem_count the number of elements to copy
    1.21   * @param reallocator the array re-allocator to use, or \c NULL
    1.22   * if re-allocation shall not happen
    1.23 - * @return zero on success, non-zero on failure
    1.24 + * @return zero on success, non-zero error code on failure
    1.25   */
    1.26 -int cx_array_copy(
    1.27 +enum cx_array_coppy_result cx_array_copy(
    1.28          void **target,
    1.29          size_t *size,
    1.30          size_t *capacity,
    1.31 @@ -120,7 +129,7 @@
    1.32          void const *src,
    1.33          size_t elem_size,
    1.34          size_t elem_count,
    1.35 -        struct cx_array_reallocator_s const *reallocator
    1.36 +        struct cx_array_reallocator_s *reallocator
    1.37  ) __attribute__((__nonnull__(1, 2, 5)));
    1.38  
    1.39  /**

mercurial