summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 286e2b1)
raw | patch | inline | side by side (parent: 286e2b1)
author | Tay Ray Chuan <rctay89@gmail.com> | |
Mon, 1 Aug 2011 04:20:07 +0000 (12:20 +0800) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Wed, 3 Aug 2011 17:15:16 +0000 (10:15 -0700) |
Given our simple mmfile structure, xdl_mmfile_next() calls are
redundant. Do away with calls to them.
Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
redundant. Do away with calls to them.
Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
xdiff/xdiff.h | patch | blob | history | |
xdiff/xprepare.c | patch | blob | history | |
xdiff/xutils.c | patch | blob | history |
diff --git a/xdiff/xdiff.h b/xdiff/xdiff.h
index c26170ce5ea900362c7af471755c1530ea2ec999..4beb10c678702a34b14914f8b292dd65b5c273cd 100644 (file)
--- a/xdiff/xdiff.h
+++ b/xdiff/xdiff.h
#define xdl_realloc(ptr,x) realloc(ptr,x)
void *xdl_mmfile_first(mmfile_t *mmf, long *size);
-void *xdl_mmfile_next(mmfile_t *mmf, long *size);
long xdl_mmfile_size(mmfile_t *mmf);
int xdl_diff(mmfile_t *mf1, mmfile_t *mf2, xpparam_t const *xpp,
diff --git a/xdiff/xprepare.c b/xdiff/xprepare.c
index dfbb0de987f4f43410b416d2fbd2ca5b278af91b..620fc9a657e2246d3a382c916c2cdd4f820c0c44 100644 (file)
--- a/xdiff/xprepare.c
+++ b/xdiff/xprepare.c
nrec = 0;
if ((cur = blk = xdl_mmfile_first(mf, &bsize)) != NULL) {
- for (top = blk + bsize;;) {
- if (cur >= top) {
- if (!(cur = blk = xdl_mmfile_next(mf, &bsize)))
- break;
- top = blk + bsize;
- }
+ for (top = blk + bsize; cur < top; ) {
prev = cur;
hav = xdl_hash_record(&cur, top, xpp->flags);
if (nrec >= narec) {
diff --git a/xdiff/xutils.c b/xdiff/xutils.c
index a45e89bbed5ba582f31aff62b13fd6ddb27b1a85..0de084e53f5144153373cc66cae7b523b4ae2812 100644 (file)
--- a/xdiff/xutils.c
+++ b/xdiff/xutils.c
}
-void *xdl_mmfile_next(mmfile_t *mmf, long *size)
-{
- return NULL;
-}
-
-
long xdl_mmfile_size(mmfile_t *mmf)
{
return mmf->size;
char const *data, *cur, *top;
if ((cur = data = xdl_mmfile_first(mf, &size)) != NULL) {
- for (top = data + size; nl < sample;) {
- if (cur >= top) {
- tsize += (long) (cur - data);
- if (!(cur = data = xdl_mmfile_next(mf, &size)))
- break;
- top = data + size;
- }
+ for (top = data + size; nl < sample && cur < top; ) {
nl++;
if (!(cur = memchr(cur, '\n', top - cur)))
cur = top;