libguf/src/test/impls/dbuf_impl.h
fruit fad608e2ed Fix failed assertion in guf_str_copy
An assertion GUF_ASSERT(str_is_valid(dst)) failed in guf_str_copy when it called guf_str_cstr(dst)
 since guf_str_cstr assumes an already valid string, which was not the case when src was a short string.

Therefore, we get the dst's c_str now without calling guf_str_cstr(dst)

(Found by writing DbufStrTest.)
2025-12-23 14:11:06 +01:00

54 lines
1.2 KiB
C

#ifndef GUF_DBUF_IMPL_H
#define GUF_DBUF_IMPL_H
#include "guf_cstr.h"
#include "guf_str.h"
#define GUF_DBUF_NAME dbuf_int
#define GUF_T int
#define GUF_T_IS_INTEGRAL_TYPE
#include "guf_dbuf.h"
#define GUF_DBUF_NAME dbuf_i32
#define GUF_T int32_t
#define GUF_T_IS_INTEGRAL_TYPE
#include "guf_dbuf.h"
#define GUF_DBUF_NAME dbuf_char
#define GUF_T char
#define GUF_T_IS_INTEGRAL_TYPE
#include "guf_dbuf.h"
#define GUF_DBUF_NAME dbuf_float
#define GUF_T float
#define GUF_T_IS_INTEGRAL_TYPE
#include "guf_dbuf.h"
#define GUF_T guf_cstr_heap
#define GUF_DBUF_NAME dbuf_heap_cstr
#define GUF_T_COPY guf_cstr_heap_copy
#define GUF_T_MOVE guf_cstr_heap_move
#define GUF_T_FREE guf_cstr_heap_free
#define GUF_T_EQ guf_cstr_heap_eq
#include "guf_dbuf.h"
#define GUF_T guf_cstr_const
#define GUF_DBUF_NAME dbuf_const_cstr
#define GUF_T_EQ guf_cstr_const_eq
#include "guf_dbuf.h"
#define GUF_T guf_str_view
#define GUF_DBUF_NAME dbuf_str_view
#define GUF_T_EQ guf_str_view_equal
#include "guf_dbuf.h"
#define GUF_T guf_str
#define GUF_DBUF_NAME dbuf_str
#define GUF_T_COPY guf_str_copy
#define GUF_T_MOVE guf_str_move
#define GUF_T_FREE guf_str_free
#define GUF_T_EQ guf_str_equal
#include "guf_dbuf.h"
#endif