git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Use memmove instead of memcpy for overlapping areas
@ 2006-10-30 21:26 Edgar Toernig
  2006-10-31  1:37 ` Junio C Hamano
  0 siblings, 1 reply; 2+ messages in thread
From: Edgar Toernig @ 2006-10-30 21:26 UTC (permalink / raw)
  To: git

There may be more - this is just the result of a quick eye-grep
for memcpy(x, x+i).

diff --git a/imap-send.c b/imap-send.c
index 16804ab..88d635f 100644
--- a/imap-send.c
+++ b/imap-send.c
@@ -272,7 +272,7 @@ buffer_gets( buffer_t * b, char **s )
 				n = b->bytes - start;
 
 				if (n)
-					memcpy( b->buf, b->buf + start, n );
+					memmove( b->buf, b->buf + start, n );
 				b->offset -= start;
 				b->bytes = n;
 				start = 0;
diff --git a/index-pack.c b/index-pack.c
index e33f605..a275982 100644
--- a/index-pack.c
+++ b/index-pack.c
@@ -61,7 +61,7 @@ static void * fill(int min)
 		die("cannot fill %d bytes", min);
 	if (input_offset) {
 		SHA1_Update(&input_ctx, input_buffer, input_offset);
-		memcpy(input_buffer, input_buffer + input_offset, input_len);
+		memmove(input_buffer, input_buffer + input_offset, input_len);
 		input_offset = 0;
 	}
 	do {


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-10-31  1:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-10-30 21:26 Use memmove instead of memcpy for overlapping areas Edgar Toernig
2006-10-31  1:37 ` Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).