diff options
author | Thomas Graf <tgr@lsx.localdomain> | 2008-05-07 11:18:30 (GMT) |
---|---|---|
committer | Thomas Graf <tgr@lsx.localdomain> | 2008-05-07 11:18:30 (GMT) |
commit | b7c5bf98c4079304f78242d8b3c65451efc12b77 (patch) | |
tree | 055260585876f1e0e4602fb3719fc53d080d31fc /lib/nl.c | |
parent | dc883cc14978fe2fc10f173c145ffc4d0c1178b0 (diff) | |
download | libnl-b7c5bf98c4079304f78242d8b3c65451efc12b77.zip libnl-b7c5bf98c4079304f78242d8b3c65451efc12b77.tar.gz libnl-b7c5bf98c4079304f78242d8b3c65451efc12b77.tar.bz2 |
Improve performance by using malloc() over calloc() in critical places
As pointed out by Regis Hanna, a considerable performance gain can be
achieved by using malloc() over calloc() when allocating netlink message
buffers. This is likely due to the fact that we use a complete page for
each message.
Diffstat (limited to 'lib/nl.c')
-rw-r--r-- | lib/nl.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -482,7 +482,7 @@ int nl_recv(struct nl_handle *handle, struct sockaddr_nl *nla, page_size = getpagesize(); iov.iov_len = page_size; - iov.iov_base = *buf = calloc(1, iov.iov_len); + iov.iov_base = *buf = malloc(iov.iov_len); if (handle->h_flags & NL_SOCK_PASSCRED) { msg.msg_controllen = CMSG_SPACE(sizeof(struct ucred)); |