src/error.c
libhwbtc_error * error_add_code(libhwbtc_error * error, uint32_t code)
{
    error = error_make_mutable(error);
    if (error == NULL || error->do_not_free) { return error; }
    if (error->code_count >= SIZE_MAX / sizeof(uint32_t)) { return error; }

    size_t size = (error->code_count + 1) * sizeof(uint32_t);
    uint32_t * new_array = realloc(error->code_array, size);
    if (new_array == NULL)
    {
        libhwbtc_error_free(error);
        return &error_masked_by_no_memory;
    }
    error->code_array = new_array;
    error->code_array[error->code_count++] = code;
    return error;
}
// Tries to add the specified code to the error.
// This is just like error_add_v in terms of pointer ownership.
Tries to add the specified code to the error.
This is just like error_add_v in terms of pointer ownership.
Tries to add the specified code to the error . This is just like error_add_v in terms of pointer ownership .
libhwbtc_error * error_add_code(libhwbtc_error * error, uint32_t code)
{
    error = error_make_mutable(error);
    if (error == NULL || error->do_not_free) { return error; }
    if (error->code_count >= SIZE_MAX / sizeof(uint32_t)) { return error; }
    size_t size = (error->code_count + 1) * sizeof(uint32_t);
    uint32_t * new_array = realloc(error->code_array, size);
    if (new_array == NULL)
    {
        libhwbtc_error_free(error);
        return &error_masked_by_no_memory;
    }
    error->code_array = new_array;
    error->code_array[error->code_count++] = code;
    return error;
}
libhwbtc_error * error_add_code ( libhwbtc_error * error , uint32_t code ) { error = error_make_mutable ( error ) ; if ( error == NULL || error -> do_not_free ) { return error ; } if ( error -> code_count >= SIZE_MAX / sizeof ( uint32_t ) ) { return error ; } size_t size = ( error -> code_count + 1 ) * sizeof ( uint32_t ) ; uint32_t * new_array = realloc ( error -> code_array , size ) ; if ( new_array == NULL ) { libhwbtc_error_free ( error ) ; return & error_masked_by_no_memory ; } error -> code_array = new_array ; error -> code_array [ error -> code_count ++ ] = code ; return error ; }
Tries to add the specified code to the error.
Tries to add the specified code to the error .