From: Tomas Hruby Date: Wed, 27 Jan 2010 09:34:47 +0000 (+0000) Subject: No need to use memcpy to copy a message of 36 bytes. The overhead just X-Git-Tag: v3.1.6~21 X-Git-Url: http://zhaoyanbai.com/repos/cppcheck-error.log?a=commitdiff_plain;h=e0f7043e04839e55f5a294a15a4d69557892d14a;p=minix.git No need to use memcpy to copy a message of 36 bytes. The overhead just to call memcpy is half of the inline copy (using gcc -O) --- diff --git a/kernel/system.c b/kernel/system.c index 93ba522c0..a64980cb2 100644 --- a/kernel/system.c +++ b/kernel/system.c @@ -115,7 +115,7 @@ PUBLIC void sys_task() */ vmassert(RTS_ISSET(caller_ptr, RTS_VMREQUEST)); vmassert(caller_ptr->p_vmrequest.type == VMSTYPE_KERNELCALL); - memcpy(&caller_ptr->p_vmrequest.saved.reqmsg, &m, sizeof(m)); + caller_ptr->p_vmrequest.saved.reqmsg = m; } else if (result != EDONTREPLY) { /* Send a reply, unless inhibited by a handler function. * Use the kernel function lock_send() to prevent a system @@ -564,7 +564,7 @@ PRIVATE struct proc *vmrestart_check(message *m) switch(type) { case VMSTYPE_KERNELCALL: - memcpy(m, &restarting->p_vmrequest.saved.reqmsg, sizeof(*m)); + *m = restarting->p_vmrequest.saved.reqmsg; restarting->p_vmrequest.saved.reqmsg.m_source = NONE; vmassert(m->m_source == restarting->p_endpoint); /* Original caller could've disappeared in the meantime. */