commit - 6303eedc563848baa1f4c48ccdb70b80393255d6
commit + 4861c9da86ada01cffa2ce3801f670587e896ce2
blob - 1d0c6fd4faa11438034964c34bfb319969e36bff
blob + 13fb82c4b8e75e74ec16e8b30fea6c29fd41efb3
--- lib/diff_main.c
+++ lib/diff_main.c
debug_dump_atoms(&state->left, chunk->left_start, chunk->left_count);
debug("R\n");
debug_dump_atoms(&state->right, chunk->right_start, chunk->right_count);
+
+ if (result->len) {
+ last = &result->head[result->len - 1];
+ assert(chunk->left_start
+ == last->left_start + last->left_count);
+ assert(chunk->right_start
+ == last->right_start + last->right_count);
+ }
if (new_t == last_t) {
new_chunk = &result->head[result->len - 1];
blob - c7749377c1c41c1fee60256db169cee8ece8fd9e
blob + 3945cbb5448b10d07a96553307d4786990824929
--- lib/diff_output_unidiff.c
+++ lib/diff_output_unidiff.c
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
+#include <assert.h>
#include <arraylist.h>
#include <diff_main.h>
result->right->root->diff_flags);
bool show_function_prototypes = (flags & DIFF_FLAG_SHOW_PROTOTYPES);
int i;
+ unsigned int check_left_pos, check_right_pos;
if (!result)
return EINVAL;
}
#if DEBUG
+ check_left_pos = 0;
+ check_right_pos = 0;
for (i = 0; i < result->chunks.len; i++) {
struct diff_chunk *c = &result->chunks.head[i];
enum diff_chunk_type t = diff_chunk_type(c);
c->right_count,
c->left_start ? diff_atom_root_idx(result->left, c->left_start) : -1,
c->right_start ? diff_atom_root_idx(result->right, c->right_start) : -1);
+ assert(check_left_pos == diff_atom_root_idx(result->left, c->left_start));
+ assert(check_right_pos == diff_atom_root_idx(result->right, c->right_start));
+ check_left_pos += c->left_count;
+ check_right_pos += c->right_count;
+
}
+ assert(check_left_pos == result->left->atoms.len);
+ assert(check_right_pos == result->right->atoms.len);
#endif
for (i = 0; i < result->chunks.len; i++) {