[C] Refactoring
This commit is contained in:
parent
7ebbf7ed19
commit
ccc9fccaa1
46
lib/fort.c
46
lib/fort.c
@ -104,7 +104,7 @@ enum str_buf_type {
|
|||||||
#endif /* FT_HAVE_WCHAR */
|
#endif /* FT_HAVE_WCHAR */
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ft_gen_string {
|
struct ft_string {
|
||||||
union {
|
union {
|
||||||
const char *cstr;
|
const char *cstr;
|
||||||
#ifdef FT_HAVE_WCHAR
|
#ifdef FT_HAVE_WCHAR
|
||||||
@ -116,8 +116,8 @@ struct ft_gen_string {
|
|||||||
const void *data;
|
const void *data;
|
||||||
} u;
|
} u;
|
||||||
enum str_buf_type type;
|
enum str_buf_type type;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
typedef struct ft_string ft_string_t;
|
||||||
|
|
||||||
|
|
||||||
typedef const char **str_arr;
|
typedef const char **str_arr;
|
||||||
@ -220,7 +220,7 @@ FT_INTERNAL
|
|||||||
size_t number_of_columns_in_format_string(const char *fmt);
|
size_t number_of_columns_in_format_string(const char *fmt);
|
||||||
|
|
||||||
FT_INTERNAL
|
FT_INTERNAL
|
||||||
size_t number_of_columns_in_format_string2(const struct ft_gen_string *fmt);
|
size_t number_of_columns_in_format_string2(const struct ft_string *fmt);
|
||||||
|
|
||||||
#if defined(FT_HAVE_WCHAR)
|
#if defined(FT_HAVE_WCHAR)
|
||||||
FT_INTERNAL
|
FT_INTERNAL
|
||||||
@ -2063,7 +2063,7 @@ FT_INTERNAL
|
|||||||
fort_row_t *create_row_from_string(const char *str);
|
fort_row_t *create_row_from_string(const char *str);
|
||||||
|
|
||||||
FT_INTERNAL
|
FT_INTERNAL
|
||||||
fort_row_t *create_row_from_fmt_string(const struct ft_gen_string *fmt, va_list *va_args);
|
fort_row_t *create_row_from_fmt_string(const struct ft_string *fmt, va_list *va_args);
|
||||||
|
|
||||||
FT_INTERNAL
|
FT_INTERNAL
|
||||||
size_t columns_in_row(const fort_row_t *row);
|
size_t columns_in_row(const fort_row_t *row);
|
||||||
@ -2635,7 +2635,7 @@ void ft_set_cur_cell(ft_table_t *table, size_t row, size_t col)
|
|||||||
table->cur_col = col;
|
table->cur_col = col;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ft_row_printf_impl_(ft_table_t *table, size_t row, const struct ft_gen_string *fmt, va_list *va)
|
static int ft_row_printf_impl_(ft_table_t *table, size_t row, const struct ft_string *fmt, va_list *va)
|
||||||
{
|
{
|
||||||
size_t i = 0;
|
size_t i = 0;
|
||||||
size_t new_cols = 0;
|
size_t new_cols = 0;
|
||||||
@ -2695,7 +2695,7 @@ int FT_PRINTF(ft_table_t *table, const char *fmt, ...)
|
|||||||
va_list va;
|
va_list va;
|
||||||
va_start(va, fmt);
|
va_start(va, fmt);
|
||||||
|
|
||||||
struct ft_gen_string fmt_str;
|
struct ft_string fmt_str;
|
||||||
fmt_str.type = CHAR_BUF;
|
fmt_str.type = CHAR_BUF;
|
||||||
fmt_str.u.cstr = fmt;
|
fmt_str.u.cstr = fmt;
|
||||||
int result = ft_row_printf_impl_(table, table->cur_row, &fmt_str, &va);
|
int result = ft_row_printf_impl_(table, table->cur_row, &fmt_str, &va);
|
||||||
@ -2709,7 +2709,7 @@ int FT_PRINTF_LN(ft_table_t *table, const char *fmt, ...)
|
|||||||
va_list va;
|
va_list va;
|
||||||
va_start(va, fmt);
|
va_start(va, fmt);
|
||||||
|
|
||||||
struct ft_gen_string fmt_str;
|
struct ft_string fmt_str;
|
||||||
fmt_str.type = CHAR_BUF;
|
fmt_str.type = CHAR_BUF;
|
||||||
fmt_str.u.cstr = fmt;
|
fmt_str.u.cstr = fmt;
|
||||||
int result = ft_row_printf_impl_(table, table->cur_row, &fmt_str, &va);
|
int result = ft_row_printf_impl_(table, table->cur_row, &fmt_str, &va);
|
||||||
@ -2730,7 +2730,7 @@ int ft_wprintf(ft_table_t *table, const wchar_t *fmt, ...)
|
|||||||
va_list va;
|
va_list va;
|
||||||
va_start(va, fmt);
|
va_start(va, fmt);
|
||||||
|
|
||||||
struct ft_gen_string fmt_str;
|
struct ft_string fmt_str;
|
||||||
fmt_str.type = W_CHAR_BUF;
|
fmt_str.type = W_CHAR_BUF;
|
||||||
fmt_str.u.wstr = fmt;
|
fmt_str.u.wstr = fmt;
|
||||||
int result = ft_row_printf_impl_(table, table->cur_row, &fmt_str, &va);
|
int result = ft_row_printf_impl_(table, table->cur_row, &fmt_str, &va);
|
||||||
@ -2744,7 +2744,7 @@ int ft_wprintf_ln(ft_table_t *table, const wchar_t *fmt, ...)
|
|||||||
va_list va;
|
va_list va;
|
||||||
va_start(va, fmt);
|
va_start(va, fmt);
|
||||||
|
|
||||||
struct ft_gen_string fmt_str;
|
struct ft_string fmt_str;
|
||||||
fmt_str.type = W_CHAR_BUF;
|
fmt_str.type = W_CHAR_BUF;
|
||||||
fmt_str.u.wstr = fmt;
|
fmt_str.u.wstr = fmt;
|
||||||
int result = ft_row_printf_impl_(table, table->cur_row, &fmt_str, &va);
|
int result = ft_row_printf_impl_(table, table->cur_row, &fmt_str, &va);
|
||||||
@ -2762,26 +2762,26 @@ void ft_set_default_printf_field_separator(char separator)
|
|||||||
g_col_separator = separator;
|
g_col_separator = separator;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ft_write_impl_(ft_table_t *table, const struct ft_gen_string *cell_content)
|
static int ft_write_impl_(ft_table_t *table, const ft_string_t *cell_content)
|
||||||
{
|
{
|
||||||
assert(table);
|
assert(table);
|
||||||
string_buffer_t *str_buffer = get_cur_str_buffer_and_create_if_not_exists(table);
|
string_buffer_t *buf = get_cur_str_buffer_and_create_if_not_exists(table);
|
||||||
if (str_buffer == NULL)
|
if (buf == NULL)
|
||||||
return FT_ERROR;
|
return FT_ERROR;
|
||||||
|
|
||||||
int status = FT_SUCCESS;
|
int status = FT_SUCCESS;
|
||||||
switch (cell_content->type) {
|
switch (cell_content->type) {
|
||||||
case CHAR_BUF:
|
case CHAR_BUF:
|
||||||
status = fill_buffer_from_string(str_buffer, cell_content->u.cstr);
|
status = fill_buffer_from_string(buf, cell_content->u.cstr);
|
||||||
break;
|
break;
|
||||||
#ifdef FT_HAVE_WCHAR
|
#ifdef FT_HAVE_WCHAR
|
||||||
case W_CHAR_BUF:
|
case W_CHAR_BUF:
|
||||||
status = fill_buffer_from_wstring(str_buffer, cell_content->u.wstr);
|
status = fill_buffer_from_wstring(buf, cell_content->u.wstr);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#ifdef FT_HAVE_UTF8
|
#ifdef FT_HAVE_UTF8
|
||||||
case UTF8_BUF:
|
case UTF8_BUF:
|
||||||
status = fill_buffer_from_u8string(str_buffer, cell_content->u.u8str);
|
status = fill_buffer_from_u8string(buf, cell_content->u.u8str);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
default:
|
default:
|
||||||
@ -2795,7 +2795,7 @@ static int ft_write_impl_(ft_table_t *table, const struct ft_gen_string *cell_co
|
|||||||
|
|
||||||
static int ft_write_impl(ft_table_t *table, const char *cell_content)
|
static int ft_write_impl(ft_table_t *table, const char *cell_content)
|
||||||
{
|
{
|
||||||
struct ft_gen_string content;
|
ft_string_t content;
|
||||||
content.type = CHAR_BUF;
|
content.type = CHAR_BUF;
|
||||||
content.u.cstr = cell_content;
|
content.u.cstr = cell_content;
|
||||||
return ft_write_impl_(table, &content);
|
return ft_write_impl_(table, &content);
|
||||||
@ -2804,7 +2804,7 @@ static int ft_write_impl(ft_table_t *table, const char *cell_content)
|
|||||||
#ifdef FT_HAVE_UTF8
|
#ifdef FT_HAVE_UTF8
|
||||||
static int ft_u8write_impl(ft_table_t *table, const void *cell_content)
|
static int ft_u8write_impl(ft_table_t *table, const void *cell_content)
|
||||||
{
|
{
|
||||||
struct ft_gen_string content;
|
ft_string_t content;
|
||||||
content.type = UTF8_BUF;
|
content.type = UTF8_BUF;
|
||||||
content.u.u8str = cell_content;
|
content.u.u8str = cell_content;
|
||||||
return ft_write_impl_(table, &content);
|
return ft_write_impl_(table, &content);
|
||||||
@ -2814,7 +2814,7 @@ static int ft_u8write_impl(ft_table_t *table, const void *cell_content)
|
|||||||
#ifdef FT_HAVE_WCHAR
|
#ifdef FT_HAVE_WCHAR
|
||||||
static int ft_wwrite_impl(ft_table_t *table, const wchar_t *cell_content)
|
static int ft_wwrite_impl(ft_table_t *table, const wchar_t *cell_content)
|
||||||
{
|
{
|
||||||
struct ft_gen_string content;
|
ft_string_t content;
|
||||||
content.type = W_CHAR_BUF;
|
content.type = W_CHAR_BUF;
|
||||||
content.u.wstr = cell_content;
|
content.u.wstr = cell_content;
|
||||||
return ft_write_impl_(table, &content);
|
return ft_write_impl_(table, &content);
|
||||||
@ -3425,7 +3425,7 @@ int ft_u8printf(ft_table_t *table, const char *fmt, ...)
|
|||||||
va_list va;
|
va_list va;
|
||||||
va_start(va, fmt);
|
va_start(va, fmt);
|
||||||
|
|
||||||
struct ft_gen_string fmt_str;
|
struct ft_string fmt_str;
|
||||||
fmt_str.type = UTF8_BUF;
|
fmt_str.type = UTF8_BUF;
|
||||||
fmt_str.u.cstr = fmt;
|
fmt_str.u.cstr = fmt;
|
||||||
int result = ft_row_printf_impl_(table, table->cur_row, &fmt_str, &va);
|
int result = ft_row_printf_impl_(table, table->cur_row, &fmt_str, &va);
|
||||||
@ -3440,7 +3440,7 @@ int ft_u8printf_ln(ft_table_t *table, const char *fmt, ...)
|
|||||||
va_list va;
|
va_list va;
|
||||||
va_start(va, fmt);
|
va_start(va, fmt);
|
||||||
|
|
||||||
struct ft_gen_string fmt_str;
|
struct ft_string fmt_str;
|
||||||
fmt_str.type = UTF8_BUF;
|
fmt_str.type = UTF8_BUF;
|
||||||
fmt_str.u.cstr = fmt;
|
fmt_str.u.cstr = fmt;
|
||||||
int result = ft_row_printf_impl_(table, table->cur_row, &fmt_str, &va);
|
int result = ft_row_printf_impl_(table, table->cur_row, &fmt_str, &va);
|
||||||
@ -3661,7 +3661,7 @@ size_t number_of_columns_in_format_u8string(const void *fmt)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
FT_INTERNAL
|
FT_INTERNAL
|
||||||
size_t number_of_columns_in_format_string2(const struct ft_gen_string *fmt)
|
size_t number_of_columns_in_format_string2(const struct ft_string *fmt)
|
||||||
{
|
{
|
||||||
switch (fmt->type) {
|
switch (fmt->type) {
|
||||||
case CHAR_BUF:
|
case CHAR_BUF:
|
||||||
@ -5596,7 +5596,7 @@ fort_row_t *create_row_from_buffer(const string_buffer_t *buffer)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
vsnprintf_buffer(string_buffer_t *buffer, const struct ft_gen_string *fmt,
|
vsnprintf_buffer(string_buffer_t *buffer, const struct ft_string *fmt,
|
||||||
va_list *va)
|
va_list *va)
|
||||||
{
|
{
|
||||||
switch (buffer->type) {
|
switch (buffer->type) {
|
||||||
@ -5617,7 +5617,7 @@ vsnprintf_buffer(string_buffer_t *buffer, const struct ft_gen_string *fmt,
|
|||||||
}
|
}
|
||||||
|
|
||||||
FT_INTERNAL
|
FT_INTERNAL
|
||||||
fort_row_t *create_row_from_fmt_string(const struct ft_gen_string *fmt, va_list *va_args)
|
fort_row_t *create_row_from_fmt_string(const struct ft_string *fmt, va_list *va_args)
|
||||||
{
|
{
|
||||||
string_buffer_t *buffer = create_string_buffer(DEFAULT_STR_BUF_SIZE, fmt->type);
|
string_buffer_t *buffer = create_string_buffer(DEFAULT_STR_BUF_SIZE, fmt->type);
|
||||||
if (buffer == NULL)
|
if (buffer == NULL)
|
||||||
|
@ -165,7 +165,7 @@ void ft_set_cur_cell(ft_table_t *table, size_t row, size_t col)
|
|||||||
table->cur_col = col;
|
table->cur_col = col;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ft_row_printf_impl_(ft_table_t *table, size_t row, const struct ft_gen_string *fmt, va_list *va)
|
static int ft_row_printf_impl_(ft_table_t *table, size_t row, const struct ft_string *fmt, va_list *va)
|
||||||
{
|
{
|
||||||
size_t i = 0;
|
size_t i = 0;
|
||||||
size_t new_cols = 0;
|
size_t new_cols = 0;
|
||||||
@ -225,7 +225,7 @@ int FT_PRINTF(ft_table_t *table, const char *fmt, ...)
|
|||||||
va_list va;
|
va_list va;
|
||||||
va_start(va, fmt);
|
va_start(va, fmt);
|
||||||
|
|
||||||
struct ft_gen_string fmt_str;
|
struct ft_string fmt_str;
|
||||||
fmt_str.type = CHAR_BUF;
|
fmt_str.type = CHAR_BUF;
|
||||||
fmt_str.u.cstr = fmt;
|
fmt_str.u.cstr = fmt;
|
||||||
int result = ft_row_printf_impl_(table, table->cur_row, &fmt_str, &va);
|
int result = ft_row_printf_impl_(table, table->cur_row, &fmt_str, &va);
|
||||||
@ -239,7 +239,7 @@ int FT_PRINTF_LN(ft_table_t *table, const char *fmt, ...)
|
|||||||
va_list va;
|
va_list va;
|
||||||
va_start(va, fmt);
|
va_start(va, fmt);
|
||||||
|
|
||||||
struct ft_gen_string fmt_str;
|
struct ft_string fmt_str;
|
||||||
fmt_str.type = CHAR_BUF;
|
fmt_str.type = CHAR_BUF;
|
||||||
fmt_str.u.cstr = fmt;
|
fmt_str.u.cstr = fmt;
|
||||||
int result = ft_row_printf_impl_(table, table->cur_row, &fmt_str, &va);
|
int result = ft_row_printf_impl_(table, table->cur_row, &fmt_str, &va);
|
||||||
@ -260,7 +260,7 @@ int ft_wprintf(ft_table_t *table, const wchar_t *fmt, ...)
|
|||||||
va_list va;
|
va_list va;
|
||||||
va_start(va, fmt);
|
va_start(va, fmt);
|
||||||
|
|
||||||
struct ft_gen_string fmt_str;
|
struct ft_string fmt_str;
|
||||||
fmt_str.type = W_CHAR_BUF;
|
fmt_str.type = W_CHAR_BUF;
|
||||||
fmt_str.u.wstr = fmt;
|
fmt_str.u.wstr = fmt;
|
||||||
int result = ft_row_printf_impl_(table, table->cur_row, &fmt_str, &va);
|
int result = ft_row_printf_impl_(table, table->cur_row, &fmt_str, &va);
|
||||||
@ -274,7 +274,7 @@ int ft_wprintf_ln(ft_table_t *table, const wchar_t *fmt, ...)
|
|||||||
va_list va;
|
va_list va;
|
||||||
va_start(va, fmt);
|
va_start(va, fmt);
|
||||||
|
|
||||||
struct ft_gen_string fmt_str;
|
struct ft_string fmt_str;
|
||||||
fmt_str.type = W_CHAR_BUF;
|
fmt_str.type = W_CHAR_BUF;
|
||||||
fmt_str.u.wstr = fmt;
|
fmt_str.u.wstr = fmt;
|
||||||
int result = ft_row_printf_impl_(table, table->cur_row, &fmt_str, &va);
|
int result = ft_row_printf_impl_(table, table->cur_row, &fmt_str, &va);
|
||||||
@ -292,26 +292,26 @@ void ft_set_default_printf_field_separator(char separator)
|
|||||||
g_col_separator = separator;
|
g_col_separator = separator;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ft_write_impl_(ft_table_t *table, const struct ft_gen_string *cell_content)
|
static int ft_write_impl_(ft_table_t *table, const ft_string_t *cell_content)
|
||||||
{
|
{
|
||||||
assert(table);
|
assert(table);
|
||||||
string_buffer_t *str_buffer = get_cur_str_buffer_and_create_if_not_exists(table);
|
string_buffer_t *buf = get_cur_str_buffer_and_create_if_not_exists(table);
|
||||||
if (str_buffer == NULL)
|
if (buf == NULL)
|
||||||
return FT_ERROR;
|
return FT_ERROR;
|
||||||
|
|
||||||
int status = FT_SUCCESS;
|
int status = FT_SUCCESS;
|
||||||
switch (cell_content->type) {
|
switch (cell_content->type) {
|
||||||
case CHAR_BUF:
|
case CHAR_BUF:
|
||||||
status = fill_buffer_from_string(str_buffer, cell_content->u.cstr);
|
status = fill_buffer_from_string(buf, cell_content->u.cstr);
|
||||||
break;
|
break;
|
||||||
#ifdef FT_HAVE_WCHAR
|
#ifdef FT_HAVE_WCHAR
|
||||||
case W_CHAR_BUF:
|
case W_CHAR_BUF:
|
||||||
status = fill_buffer_from_wstring(str_buffer, cell_content->u.wstr);
|
status = fill_buffer_from_wstring(buf, cell_content->u.wstr);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#ifdef FT_HAVE_UTF8
|
#ifdef FT_HAVE_UTF8
|
||||||
case UTF8_BUF:
|
case UTF8_BUF:
|
||||||
status = fill_buffer_from_u8string(str_buffer, cell_content->u.u8str);
|
status = fill_buffer_from_u8string(buf, cell_content->u.u8str);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
default:
|
default:
|
||||||
@ -325,7 +325,7 @@ static int ft_write_impl_(ft_table_t *table, const struct ft_gen_string *cell_co
|
|||||||
|
|
||||||
static int ft_write_impl(ft_table_t *table, const char *cell_content)
|
static int ft_write_impl(ft_table_t *table, const char *cell_content)
|
||||||
{
|
{
|
||||||
struct ft_gen_string content;
|
ft_string_t content;
|
||||||
content.type = CHAR_BUF;
|
content.type = CHAR_BUF;
|
||||||
content.u.cstr = cell_content;
|
content.u.cstr = cell_content;
|
||||||
return ft_write_impl_(table, &content);
|
return ft_write_impl_(table, &content);
|
||||||
@ -334,7 +334,7 @@ static int ft_write_impl(ft_table_t *table, const char *cell_content)
|
|||||||
#ifdef FT_HAVE_UTF8
|
#ifdef FT_HAVE_UTF8
|
||||||
static int ft_u8write_impl(ft_table_t *table, const void *cell_content)
|
static int ft_u8write_impl(ft_table_t *table, const void *cell_content)
|
||||||
{
|
{
|
||||||
struct ft_gen_string content;
|
ft_string_t content;
|
||||||
content.type = UTF8_BUF;
|
content.type = UTF8_BUF;
|
||||||
content.u.u8str = cell_content;
|
content.u.u8str = cell_content;
|
||||||
return ft_write_impl_(table, &content);
|
return ft_write_impl_(table, &content);
|
||||||
@ -344,7 +344,7 @@ static int ft_u8write_impl(ft_table_t *table, const void *cell_content)
|
|||||||
#ifdef FT_HAVE_WCHAR
|
#ifdef FT_HAVE_WCHAR
|
||||||
static int ft_wwrite_impl(ft_table_t *table, const wchar_t *cell_content)
|
static int ft_wwrite_impl(ft_table_t *table, const wchar_t *cell_content)
|
||||||
{
|
{
|
||||||
struct ft_gen_string content;
|
ft_string_t content;
|
||||||
content.type = W_CHAR_BUF;
|
content.type = W_CHAR_BUF;
|
||||||
content.u.wstr = cell_content;
|
content.u.wstr = cell_content;
|
||||||
return ft_write_impl_(table, &content);
|
return ft_write_impl_(table, &content);
|
||||||
@ -955,7 +955,7 @@ int ft_u8printf(ft_table_t *table, const char *fmt, ...)
|
|||||||
va_list va;
|
va_list va;
|
||||||
va_start(va, fmt);
|
va_start(va, fmt);
|
||||||
|
|
||||||
struct ft_gen_string fmt_str;
|
struct ft_string fmt_str;
|
||||||
fmt_str.type = UTF8_BUF;
|
fmt_str.type = UTF8_BUF;
|
||||||
fmt_str.u.cstr = fmt;
|
fmt_str.u.cstr = fmt;
|
||||||
int result = ft_row_printf_impl_(table, table->cur_row, &fmt_str, &va);
|
int result = ft_row_printf_impl_(table, table->cur_row, &fmt_str, &va);
|
||||||
@ -970,7 +970,7 @@ int ft_u8printf_ln(ft_table_t *table, const char *fmt, ...)
|
|||||||
va_list va;
|
va_list va;
|
||||||
va_start(va, fmt);
|
va_start(va, fmt);
|
||||||
|
|
||||||
struct ft_gen_string fmt_str;
|
struct ft_string fmt_str;
|
||||||
fmt_str.type = UTF8_BUF;
|
fmt_str.type = UTF8_BUF;
|
||||||
fmt_str.u.cstr = fmt;
|
fmt_str.u.cstr = fmt;
|
||||||
int result = ft_row_printf_impl_(table, table->cur_row, &fmt_str, &va);
|
int result = ft_row_printf_impl_(table, table->cur_row, &fmt_str, &va);
|
||||||
|
@ -193,7 +193,7 @@ size_t number_of_columns_in_format_u8string(const void *fmt)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
FT_INTERNAL
|
FT_INTERNAL
|
||||||
size_t number_of_columns_in_format_string2(const struct ft_gen_string *fmt)
|
size_t number_of_columns_in_format_string2(const struct ft_string *fmt)
|
||||||
{
|
{
|
||||||
switch (fmt->type) {
|
switch (fmt->type) {
|
||||||
case CHAR_BUF:
|
case CHAR_BUF:
|
||||||
|
@ -67,7 +67,7 @@ enum str_buf_type {
|
|||||||
#endif /* FT_HAVE_WCHAR */
|
#endif /* FT_HAVE_WCHAR */
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ft_gen_string {
|
struct ft_string {
|
||||||
union {
|
union {
|
||||||
const char *cstr;
|
const char *cstr;
|
||||||
#ifdef FT_HAVE_WCHAR
|
#ifdef FT_HAVE_WCHAR
|
||||||
@ -79,8 +79,8 @@ struct ft_gen_string {
|
|||||||
const void *data;
|
const void *data;
|
||||||
} u;
|
} u;
|
||||||
enum str_buf_type type;
|
enum str_buf_type type;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
typedef struct ft_string ft_string_t;
|
||||||
|
|
||||||
|
|
||||||
typedef const char **str_arr;
|
typedef const char **str_arr;
|
||||||
@ -183,7 +183,7 @@ FT_INTERNAL
|
|||||||
size_t number_of_columns_in_format_string(const char *fmt);
|
size_t number_of_columns_in_format_string(const char *fmt);
|
||||||
|
|
||||||
FT_INTERNAL
|
FT_INTERNAL
|
||||||
size_t number_of_columns_in_format_string2(const struct ft_gen_string *fmt);
|
size_t number_of_columns_in_format_string2(const struct ft_string *fmt);
|
||||||
|
|
||||||
#if defined(FT_HAVE_WCHAR)
|
#if defined(FT_HAVE_WCHAR)
|
||||||
FT_INTERNAL
|
FT_INTERNAL
|
||||||
|
@ -616,7 +616,7 @@ fort_row_t *create_row_from_buffer(const string_buffer_t *buffer)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
vsnprintf_buffer(string_buffer_t *buffer, const struct ft_gen_string *fmt,
|
vsnprintf_buffer(string_buffer_t *buffer, const struct ft_string *fmt,
|
||||||
va_list *va)
|
va_list *va)
|
||||||
{
|
{
|
||||||
switch (buffer->type) {
|
switch (buffer->type) {
|
||||||
@ -637,7 +637,7 @@ vsnprintf_buffer(string_buffer_t *buffer, const struct ft_gen_string *fmt,
|
|||||||
}
|
}
|
||||||
|
|
||||||
FT_INTERNAL
|
FT_INTERNAL
|
||||||
fort_row_t *create_row_from_fmt_string(const struct ft_gen_string *fmt, va_list *va_args)
|
fort_row_t *create_row_from_fmt_string(const struct ft_string *fmt, va_list *va_args)
|
||||||
{
|
{
|
||||||
string_buffer_t *buffer = create_string_buffer(DEFAULT_STR_BUF_SIZE, fmt->type);
|
string_buffer_t *buffer = create_string_buffer(DEFAULT_STR_BUF_SIZE, fmt->type);
|
||||||
if (buffer == NULL)
|
if (buffer == NULL)
|
||||||
|
@ -22,7 +22,7 @@ FT_INTERNAL
|
|||||||
fort_row_t *create_row_from_string(const char *str);
|
fort_row_t *create_row_from_string(const char *str);
|
||||||
|
|
||||||
FT_INTERNAL
|
FT_INTERNAL
|
||||||
fort_row_t *create_row_from_fmt_string(const struct ft_gen_string *fmt, va_list *va_args);
|
fort_row_t *create_row_from_fmt_string(const struct ft_string *fmt, va_list *va_args);
|
||||||
|
|
||||||
FT_INTERNAL
|
FT_INTERNAL
|
||||||
size_t columns_in_row(const fort_row_t *row);
|
size_t columns_in_row(const fort_row_t *row);
|
||||||
|
Loading…
Reference in New Issue
Block a user