git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: git@vger.kernel.org
Cc: Junio C Hamano <gitster@pobox.com>
Subject: [PATCH 1/4] diffcore_count_changes: pass diffcore_filespec
Date: Thu, 28 Jun 2007 23:35:58 -0700	[thread overview]
Message-ID: <11830989612019-git-send-email-gitster@pobox.com> (raw)
In-Reply-To: <7v3b0bi88r.fsf@assigned-by-dhcp.pobox.com>

We may want to use richer information on the data we are dealing
with in this function, so instead of passing a buffer address
and length, just pass the diffcore_filespec structure.  Existing
callers always call this function with parameters taken from a
filespec anyway, so there is no functionality changes.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 diffcore-break.c  |    3 +--
 diffcore-delta.c  |    8 ++++----
 diffcore-rename.c |    3 +--
 diffcore.h        |    4 ++--
 4 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/diffcore-break.c b/diffcore-break.c
index 9c19b8c..ae8a7d0 100644
--- a/diffcore-break.c
+++ b/diffcore-break.c
@@ -66,8 +66,7 @@ static int should_break(struct diff_filespec *src,
 	if (base_size < MINIMUM_BREAK_SIZE)
 		return 0; /* we do not break too small filepair */
 
-	if (diffcore_count_changes(src->data, src->size,
-				   dst->data, dst->size,
+	if (diffcore_count_changes(src, dst,
 				   NULL, NULL,
 				   0,
 				   &src_copied, &literal_added))
diff --git a/diffcore-delta.c b/diffcore-delta.c
index 7338a40..0e1fae7 100644
--- a/diffcore-delta.c
+++ b/diffcore-delta.c
@@ -156,8 +156,8 @@ static struct spanhash_top *hash_chars(unsigned char *buf, unsigned int sz)
 	return hash;
 }
 
-int diffcore_count_changes(void *src, unsigned long src_size,
-			   void *dst, unsigned long dst_size,
+int diffcore_count_changes(struct diff_filespec *src,
+			   struct diff_filespec *dst,
 			   void **src_count_p,
 			   void **dst_count_p,
 			   unsigned long delta_limit,
@@ -172,14 +172,14 @@ int diffcore_count_changes(void *src, unsigned long src_size,
 	if (src_count_p)
 		src_count = *src_count_p;
 	if (!src_count) {
-		src_count = hash_chars(src, src_size);
+		src_count = hash_chars(src->data, src->size);
 		if (src_count_p)
 			*src_count_p = src_count;
 	}
 	if (dst_count_p)
 		dst_count = *dst_count_p;
 	if (!dst_count) {
-		dst_count = hash_chars(dst, dst_size);
+		dst_count = hash_chars(dst->data, dst->size);
 		if (dst_count_p)
 			*dst_count_p = dst_count;
 	}
diff --git a/diffcore-rename.c b/diffcore-rename.c
index 79c984c..cb22736 100644
--- a/diffcore-rename.c
+++ b/diffcore-rename.c
@@ -189,8 +189,7 @@ static int estimate_similarity(struct diff_filespec *src,
 
 	delta_limit = (unsigned long)
 		(base_size * (MAX_SCORE-minimum_score) / MAX_SCORE);
-	if (diffcore_count_changes(src->data, src->size,
-				   dst->data, dst->size,
+	if (diffcore_count_changes(src, dst,
 				   &src->cnt_data, &dst->cnt_data,
 				   delta_limit,
 				   &src_copied, &literal_added))
diff --git a/diffcore.h b/diffcore.h
index 7b9294e..990dec5 100644
--- a/diffcore.h
+++ b/diffcore.h
@@ -103,8 +103,8 @@ void diff_debug_queue(const char *, struct diff_queue_struct *);
 #define diff_debug_queue(a,b) do {} while(0)
 #endif
 
-extern int diffcore_count_changes(void *src, unsigned long src_size,
-				  void *dst, unsigned long dst_size,
+extern int diffcore_count_changes(struct diff_filespec *src,
+				  struct diff_filespec *dst,
 				  void **src_count_p,
 				  void **dst_count_p,
 				  unsigned long delta_limit,
-- 
1.5.2.2.1414.g1e7d9

  reply	other threads:[~2007-06-29  6:36 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <93c3eada0706280153w1898be80u7785ef2b2b1dd188@mail.gmail.com>
2007-06-29  6:07 ` Applying patches in a directory that isn't a repository Geoff Russell
2007-06-29  6:29   ` Junio C Hamano
2007-06-29  6:35     ` Junio C Hamano [this message]
2007-06-29  6:35     ` [PATCH 2/4] diffcore_filespec: add is_binary Junio C Hamano
2007-06-29  6:36     ` [PATCH 3/4] diffcore-delta.c: update the comment on the algorithm Junio C Hamano
2007-06-29  6:36     ` [PATCH 4/4] diffcore-delta.c: Ignore CR in CRLF for text files Junio C Hamano
2007-06-29  8:14       ` しらいしななこ
2007-06-29  8:51         ` Junio C Hamano
2007-06-30  4:18     ` Applying patches in a directory that isn't a repository Geoff Russell

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=11830989612019-git-send-email-gitster@pobox.com \
    --to=gitster@pobox.com \
    --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).