[F] Fixed incorrect error processing
This commit is contained in:
parent
fee7ed20ba
commit
155a47a5dd
@ -848,6 +848,8 @@ fort_cell_t *copy_cell(fort_cell_t *cell)
|
|||||||
assert(cell);
|
assert(cell);
|
||||||
|
|
||||||
fort_cell_t *result = create_cell();
|
fort_cell_t *result = create_cell();
|
||||||
|
if (result == NULL)
|
||||||
|
return NULL;
|
||||||
destroy_string_buffer(result->str_buffer);
|
destroy_string_buffer(result->str_buffer);
|
||||||
result->str_buffer = copy_string_buffer(cell->str_buffer);
|
result->str_buffer = copy_string_buffer(cell->str_buffer);
|
||||||
if (result->str_buffer == NULL) {
|
if (result->str_buffer == NULL) {
|
||||||
|
@ -38,6 +38,8 @@ fort_cell_t *copy_cell(fort_cell_t *cell)
|
|||||||
assert(cell);
|
assert(cell);
|
||||||
|
|
||||||
fort_cell_t *result = create_cell();
|
fort_cell_t *result = create_cell();
|
||||||
|
if (result == NULL)
|
||||||
|
return NULL;
|
||||||
destroy_string_buffer(result->str_buffer);
|
destroy_string_buffer(result->str_buffer);
|
||||||
result->str_buffer = copy_string_buffer(cell->str_buffer);
|
result->str_buffer = copy_string_buffer(cell->str_buffer);
|
||||||
if (result->str_buffer == NULL) {
|
if (result->str_buffer == NULL) {
|
||||||
|
@ -27,6 +27,7 @@ void test_free(void *ptr)
|
|||||||
static int create_table_and_show(void)
|
static int create_table_and_show(void)
|
||||||
{
|
{
|
||||||
ft_table_t *table = NULL;
|
ft_table_t *table = NULL;
|
||||||
|
ft_table_t *table_copy = NULL;
|
||||||
int result = 0;
|
int result = 0;
|
||||||
|
|
||||||
table = ft_create_table();
|
table = ft_create_table();
|
||||||
@ -62,11 +63,17 @@ static int create_table_and_show(void)
|
|||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *table_str = ft_to_string(table);
|
table_copy = ft_copy_table(table);
|
||||||
if (table_str == NULL) {
|
if (table_copy == NULL) {
|
||||||
result = 8;
|
result = 8;
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char *table_str = ft_to_string(table_copy);
|
||||||
|
if (table_str == NULL) {
|
||||||
|
result = 9;
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
const char *table_str_etalon =
|
const char *table_str_etalon =
|
||||||
"+---+---+-----+----------+\n"
|
"+---+---+-----+----------+\n"
|
||||||
"| | | | |\n"
|
"| | | | |\n"
|
||||||
@ -87,13 +94,14 @@ static int create_table_and_show(void)
|
|||||||
"+---+---+-----+----------+\n";
|
"+---+---+-----+----------+\n";
|
||||||
/*assert_str_equal(table_str, table_str_etalon);*/
|
/*assert_str_equal(table_str, table_str_etalon);*/
|
||||||
if (strcmp(table_str, table_str_etalon) != 0) {
|
if (strcmp(table_str, table_str_etalon) != 0) {
|
||||||
result = 9;
|
result = 10;
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
ft_destroy_table(table);
|
ft_destroy_table(table);
|
||||||
|
ft_destroy_table(table_copy);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user