git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Edgar Toernig <froese@gmx.de>
To: git@vger.kernel.org
Subject: Use memmove instead of memcpy for overlapping areas
Date: Mon, 30 Oct 2006 22:26:15 +0100	[thread overview]
Message-ID: <20061030222615.1e38908b.froese@gmx.de> (raw)

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 {


             reply	other threads:[~2006-10-30 21:26 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-30 21:26 Edgar Toernig [this message]
2006-10-31  1:37 ` Use memmove instead of memcpy for overlapping areas Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20061030222615.1e38908b.froese@gmx.de \
    --to=froese@gmx.de \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).