i starting too high
Tishj opened this issue · 1 comments
Tishj commented
static void *xmalloc(size_t size)
{
static int fail = 0;
static int i = 1;
if (i == fail)
return (NULL);
i++;
return (malloc(size));
}
I set the at_which_malloc_to_fail
to 0, because i starts at 1 this will never happen
also if I could make a suggestion, there's no need for 2 static variables, since one is generated anyways, if (i == X)
would be enough I think :P?
hilmi-yilmaz commented
Fixed the at_which_malloc_to_fail. Now the user can only enter values starting from 1. Also removed the static from fail variable. Thanks Thijs!