commit - 417a6e492637a0a223ba0d9830101a574ee1ed50
commit + 2a1b94d029d73b14949971a9f159da4670584ee9
blob - 882f94d7166ec134f12b1d70b4a076a0f17877a7
blob + 438e9c4e73f56cd2f0eb9d2cfcf6766893b10883
--- lib/diff_atomize_text.c
+++ lib/diff_atomize_text.c
#include <diff/arraylist.h>
#include <diff/diff_main.h>
-#include "diff_debug.h"
#include "diff_internal.h"
+#include "diff_debug.h"
static int
diff_data_atomize_text_lines_fd(struct diff_data *d)
blob - 84e300ed36abdaf7a9949b72130ac7e7272686fe
blob + fc5584e64ec1bc1f39b919878e371e50c8a9f0c4
--- lib/diff_debug.h
+++ lib/diff_debug.h
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#define DEBUG 0
+#define DEBUG 1
#if DEBUG
#include <stdio.h>
return;
}
if (left)
- print(" %3ld", diff_atom_root_idx(left, atom));
+ print(" %3u", diff_atom_root_idx(left, atom));
if (right && atom->patience.pos_in_other)
- print(" %3ld",
+ print(" %3u",
diff_atom_root_idx(right, atom->patience.pos_in_other));
print(" %s%s '",
if (atom->at == NULL) {
unsigned long long total = 0;
off_t remain = atom->len;
- if (lseek(atom->d->root->fd, atom->pos, SEEK_SET) == -1)
+ if (fseek(atom->d->root->f, atom->pos, SEEK_SET) == -1)
abort(); /* cannot return error */
while (remain > 0) {
char buf[16];
- ssize_t r;
+ size_t r;
int i;
- r = read(atom->d->root->fd, buf,
- MIN(remain, sizeof(buf)));
+ r = fread(buf, 1, MIN(remain, sizeof(buf)),
+ atom->d->root->f);
if (r == -1)
abort(); /* cannot return error */
if (r == 0)
print(" ");
for (x = 0; x < l->atoms.len; x++) {
- if (diff_atom_same(&l->atoms.head[x],
- &r->atoms.head[y]))
+ bool same;
+ diff_atom_same(&same, &l->atoms.head[x],
+ &r->atoms.head[y]);
+ if (same)
print("|\\");
else
print("| ");
blob - 72a7a3d9970ce9219dcadb1b60ce2c935437cb03
blob + 6b5c37f50b58796347ffae9293e99c30adc72549
--- lib/diff_main.c
+++ lib/diff_main.c
#include <diff/arraylist.h>
#include <diff/diff_main.h>
-#include "diff_debug.h"
#include "diff_internal.h"
+#include "diff_debug.h"
static int
read_at(FILE *f, off_t at_pos, unsigned char *buf, size_t len)
blob - c10e5e5475cce9bedea908a75e628123a864d339
blob + a21aeee883c98dd77c1a1b5a8c58d46654e0e2f6
--- lib/diff_myers.c
+++ lib/diff_myers.c
#include <diff/arraylist.h>
#include <diff/diff_main.h>
-#include "diff_debug.h"
#include "diff_internal.h"
+#include "diff_debug.h"
/* Myers' diff algorithm [1] is nicely explained in [2].
* [1] http://www.xmailserver.org/diff2.pdf
blob - 6884dc68ad3be1a036549c8784fcbe11288719e6
blob + a9a176b4261f749224df4eebf1c0bea6f37b2026
--- lib/diff_output_unidiff.c
+++ lib/diff_output_unidiff.c
#include <diff/diff_main.h>
#include <diff/diff_output.h>
-#include "diff_debug.h"
#include "diff_internal.h"
+#include "diff_debug.h"
static bool
chunk_context_empty(const struct diff_chunk_context *cc)
blob - 80af37f56e32b7c6d1fbf33b2d1dc07db12346c3
blob + 6922a7308a35a266bfc5e71aea83f2abd2bd70aa
--- lib/diff_patience.c
+++ lib/diff_patience.c
#include <diff/arraylist.h>
#include <diff/diff_main.h>
-#include "diff_debug.h"
#include "diff_internal.h"
+#include "diff_debug.h"
/* Set unique_here = true for all atoms that exist exactly once in this list. */
static int
if (i < lcs_count) {
atom = lcs[i];
atom_r = atom->patience.pos_in_other;
- debug("lcs[%u] = left[%ld] = right[%ld]\n", i,
+ debug("lcs[%u] = left[%u] = right[%u]\n", i,
diff_atom_idx(left, atom), diff_atom_idx(right, atom_r));
left_idx = atom->patience.identical_lines.start;
right_idx = atom_r->patience.identical_lines.start;