Re: why use memcpy when memmove is there?

From: Robert Hancock
Date: Mon Aug 13 2007 - 12:06:00 EST


sk malik wrote:
Hi, All

We were looking at "[kernel]/lib/string.c"
(http://lxr.linux.no/source/lib/string.c#L500)

memcpy copies a part of memory to some other location
but It will not work for all cases of overlapping
blocks.(if the start of destination block falls
between the source block)

while memove copes with overlapping areas.

then why is memcpy present in the sources can't we
simply do

"#define memcpy memmove" in include/linux/string.h

or am I missing something?

Because the assumption that the areas don't overlap means memcpy can be more efficient.

--
Robert Hancock Saskatoon, SK, Canada
To email, remove "nospam" from hancockr@xxxxxxxxxxxxx
Home Page: http://www.roberthancock.com/

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/