feature #2

Closed
thoehne wants to merge 4 commits from feature into main
10 changed files with 387 additions and 72 deletions
Showing only changes of commit 763781b92d - Show all commits

View File

@@ -28,8 +28,9 @@
if (exp != act) \
{ \
test->passed = false; \
test->error_msg = format_string( \
"Expected %d to be %d\n Failed with message: " msg, act, exp); \
test->error_msg = \
format_string("Expected %d to be %d\n Failed with message: %s", \
act, exp, msg); \
return; \
}

View File

@@ -28,8 +28,11 @@ struct SETBlockMeta *set_ll_free_one(struct SETBlockMeta *head, void *address)
if (meta == head)
{
struct SETBlockMeta *ret = meta->next;
ret->prev = NULL;
ret->end = meta->end;
if (ret)
{
ret->prev = NULL;
ret->end = meta->end;
}
free(meta);
return ret;
}

View File

@@ -15,7 +15,7 @@ char *format_string(const char *fmt, ...)
va_list args;
va_start(args, fmt);
size_t size = vsnprintf(NULL, 0, fmt, args);
char *out = (char *)malloc(size + 1);
char *out = (char *)set_malloc(size + 1);
if (!out)
{

View File

@@ -61,6 +61,7 @@ TEST(Other_Basic)
TEST(Other_With_Malloc)
{
int *some_array = set_malloc(20 * sizeof(int));
int *array = set_malloc(20);
for (int i = 0; i < 20; i++)
{
@@ -73,6 +74,9 @@ TEST(Other_With_Malloc)
}
fprintf(stdout, ".\n");
set_free(array);
set_free(some_array);
ASSERT_TRUE(false);
}