mirror of
https://github.com/adtools/clib2.git
synced 2025-12-08 14:59:05 +00:00
Added assertion test for the buffer alignment padding size.
This commit is contained in:
@ -125,6 +125,8 @@ setvbuf(FILE *stream,char *buf,int bufmode,size_t size)
|
|||||||
allocate some memory for it. */
|
allocate some memory for it. */
|
||||||
if(size > 0 && buf == NULL)
|
if(size > 0 && buf == NULL)
|
||||||
{
|
{
|
||||||
|
assert( size <= ((size + (__cache_line_size-1)) & ~(__cache_line_size-1)) );
|
||||||
|
|
||||||
/* Allocate a little more memory than necessary. */
|
/* Allocate a little more memory than necessary. */
|
||||||
new_buffer = malloc(size + (__cache_line_size-1));
|
new_buffer = malloc(size + (__cache_line_size-1));
|
||||||
if(new_buffer == NULL)
|
if(new_buffer == NULL)
|
||||||
|
|||||||
Reference in New Issue
Block a user