Project

General

Profile

Feature #582 ยป 0072-Add-nonnull-attributes-for-string_vector.-ch-functio.patch

Marko Lindqvist, 05/10/2024 05:14 PM

View differences:

utility/string_vector.c
const char *strvec_to_or_list(const struct strvec *psv,
struct astring *astr)
{
fc_assert_ret_val(psv != nullptr, nullptr);
return astr_build_or_list(astr, (const char **) psv->vec, psv->size);
}
......
const char *strvec_to_and_list(const struct strvec *psv,
struct astring *astr)
{
fc_assert_ret_val(psv != nullptr, nullptr);
return astr_build_and_list(astr, (const char **) psv->vec, psv->size);
}
utility/string_vector.h
struct strvec *strvec_new(void);
void strvec_destroy(struct strvec *psv);
void strvec_reserve(struct strvec *psv, size_t reserve);
void strvec_store(struct strvec *psv, const char *const *vec, size_t size);
void strvec_from_str(struct strvec *psv, char separator, const char *str);
void strvec_clear(struct strvec *psv);
void strvec_remove_empty(struct strvec *psv);
void strvec_reserve(struct strvec *psv, size_t reserve)
fc__attribute((nonnull (1)));
void strvec_store(struct strvec *psv, const char *const *vec, size_t size)
fc__attribute((nonnull (1, 2)));
void strvec_from_str(struct strvec *psv, char separator, const char *str)
fc__attribute((nonnull (1)));
void strvec_clear(struct strvec *psv)
fc__attribute((nonnull (1)));
void strvec_remove_empty(struct strvec *psv)
fc__attribute((nonnull (1)));
void strvec_remove_duplicate(struct strvec *psv,
int (*cmp_func) (const char *, const char *));
void strvec_copy(struct strvec *dest, const struct strvec *src);
int (*cmp_func) (const char *, const char *))
fc__attribute((nonnull (1)));
void strvec_copy(struct strvec *dest, const struct strvec *src)
fc__attribute((nonnull (1, 2)));
void strvec_sort(struct strvec *psv, int (*sort_func) (const char *const *,
const char *const *));
const char *const *))
fc__attribute((nonnull (1)));
void strvec_prepend(struct strvec *psv, const char *string);
void strvec_append(struct strvec *psv, const char *string);
void strvec_insert(struct strvec *psv, size_t svindex, const char *string);
void strvec_prepend(struct strvec *psv, const char *string)
fc__attribute((nonnull (1)));
void strvec_append(struct strvec *psv, const char *string)
fc__attribute((nonnull (1)));
void strvec_insert(struct strvec *psv, size_t svindex, const char *string)
fc__attribute((nonnull (1)));
bool strvec_set(struct strvec *psv, size_t svindex, const char *string);
bool strvec_remove(struct strvec *psv, size_t svindex);
size_t strvec_size(const struct strvec *psv);
size_t strvec_size(const struct strvec *psv)
fc__attribute((nonnull (1)));
bool are_strvecs_equal(const struct strvec *stv1,
const struct strvec *stv2);
const char *const *strvec_data(const struct strvec *psv);
bool strvec_index_valid(const struct strvec *psv, size_t svindex);
const char *strvec_get(const struct strvec *psv, size_t svindex);
const struct strvec *stv2)
fc__attribute((nonnull (1, 2)));
const char *const *strvec_data(const struct strvec *psv)
fc__attribute((nonnull (1)));
bool strvec_index_valid(const struct strvec *psv, size_t svindex)
fc__attribute((nonnull (1)));
const char *strvec_get(const struct strvec *psv, size_t svindex)
fc__attribute((nonnull (1)));
void strvec_to_str(const struct strvec *psv, char separator,
char *buf, size_t buf_len);
const char *strvec_to_or_list(const struct strvec *psv,
struct astring *astr);
struct astring *astr)
fc__attribute((nonnull (1)));
const char *strvec_to_and_list(const struct strvec *psv,
struct astring *astr);
struct astring *astr)
fc__attribute((nonnull (1)));
/* Iteration macro. */
#define strvec_iterate(psv, str) \
    (1-1/1)