1
0
Fork 0
mirror of https://github.com/davatorium/rofi.git synced 2025-02-10 15:44:41 -05:00

Replace malloc/memset with calloc.

This commit is contained in:
Qball Cow 2014-04-24 14:25:18 +02:00
parent bb119f6831
commit 46309a6fd5

View file

@ -128,8 +128,15 @@ void* allocate_clear ( unsigned long bytes )
return NULL;
}
void *ptr = allocate ( bytes );
memset ( ptr, 0, bytes );
// malloc+memset we can do in one call using calloc.
void *ptr = calloc ( bytes, 1 );
if ( !ptr )
{
fprintf ( stderr, "calloc failed!\n" );
exit ( EXIT_FAILURE );
}
return ptr;
}
void* reallocate ( void *ptr, unsigned long bytes )