~donmcc/astr

5ed773f7d4d048ebea586fb9432b907d3aff24ac — Don McCaughey 1 year, 1 month ago 0a436b7
Make `va_list` parameters `const`.

The functions `astr_formatted_length_from_va_list()`,
`astr_realloc_append_formatted_from_va_list()` and
`astr_alloc_formatted_from_va_list()` are already defensively copying
their `va_list` parameters, so make these parameters `const` to
communicate this.
2 files changed, 6 insertions(+), 6 deletions(-)

M astr.c
M astr.h
M astr.c => astr.c +3 -3
@@ 27,7 27,7 @@ astr_formatted_length(char const *format, ...)


size_t
astr_formatted_length_from_va_list(char const *format, va_list arguments)
astr_formatted_length_from_va_list(char const *format, va_list const arguments)
{
    if (!format) {
        errno = EINVAL;


@@ 56,7 56,7 @@ astr_realloc_append_formatted(char **s, char const *format, ...)
int
astr_realloc_append_formatted_from_va_list(char **s, 
                                           char const *format, 
                                           va_list arguments)
                                           va_list const arguments)
{
    if (!s || !format) {
        errno = EINVAL;


@@ 84,7 84,7 @@ extern char *
astr_alloc_empty(void);

extern char *
astr_alloc_formatted_from_va_list(char const *format, va_list arguments);
astr_alloc_formatted_from_va_list(char const *format, const va_list arguments);

extern int 
astr_cmp(char const *s1, char const *s2);

M astr.h => astr.h +3 -3
@@ 15,7 15,7 @@ size_t
astr_formatted_length(char const *format, ...);

size_t
astr_formatted_length_from_va_list(char const *format, va_list arguments);
astr_formatted_length_from_va_list(char const *format, va_list const arguments);

int
astr_realloc_append_formatted(char **s, char const *format, ...);


@@ 23,7 23,7 @@ astr_realloc_append_formatted(char **s, char const *format, ...);
int
astr_realloc_append_formatted_from_va_list(char **s, 
                                           char const *format, 
                                           va_list arguments);
                                           va_list const arguments);


inline char *


@@ 33,7 33,7 @@ astr_alloc_empty(void)
}

inline char *
astr_alloc_formatted_from_va_list(char const *format, va_list arguments)
astr_alloc_formatted_from_va_list(char const *format, const va_list arguments)
{
    char *s = NULL;
    int result = astr_realloc_append_formatted_from_va_list(&s, format, arguments);