Patch #9307: Replace mem_malloc+memset with mem_calloc
Aside from reducing source code, on systems which use MEM_LIBC_MALLOC, this has the potential to improve performance depending on the underlying memory allocator See http://stackoverflow.com/questions/2688466/why-mallocmemset-is-slower-than-calloc
This commit is contained in:
@@ -280,9 +280,8 @@ static void test_sockets_msgapi_tcp(int domain)
|
||||
}
|
||||
|
||||
/* allocate a receive buffer, same size as snd_buf for easy verification */
|
||||
rcv_buf = (u8_t*)mem_malloc(BUF_SZ);
|
||||
rcv_buf = (u8_t*)mem_calloc(1, BUF_SZ);
|
||||
fail_unless(rcv_buf != NULL);
|
||||
memset(rcv_buf, 0, BUF_SZ);
|
||||
/* split across iovs */
|
||||
for (i = 0; i < 4; i++) {
|
||||
riovs[i].iov_base = &rcv_buf[i*(BUF_SZ/4)];
|
||||
|
||||
Reference in New Issue
Block a user