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:
parent
bb119f6831
commit
46309a6fd5
1 changed files with 9 additions and 2 deletions
|
@ -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 )
|
||||
|
|
Loading…
Add table
Reference in a new issue