commit - 67157248154a23138c2b7ff2eebecbdf3d079ef7
commit + d59645ca93e848225789f77b1f84f3f0deced858
blob - 40142164742fb5bb3d4316a5bca80a90d132836c
blob + 1860f72f783037ecbfabf0432313bd8498ff44ac
--- include/diff_main.h
+++ include/diff_main.h
struct diff_data *left,
struct diff_data *right);
void diff_result_free(struct diff_result *result);
+
+void diff_result_plus_lines(const struct diff_result *result,
+ void(*plus_lines_cb)(unsigned int first_atom_idx, unsigned int atoms));
blob - 69aea0a6aaf3ddfe78f7567e8a2405ae2d0c81e0
blob + 4eab36b52ec40f795ad60515f5a7ba6374a37835
--- lib/diff_main.c
+++ lib/diff_main.c
diff_data_init_root(d, f, data, len, diff_flags);
return config->atomize_func(config->atomize_func_data, d);
+
+}
+void print_plus_lines(unsigned int first_atom_idx, unsigned int atoms)
+{
+ printf("+ %u,%u\n", 1 + first_atom_idx, atoms);
}
struct diff_result *
result->rc = diff_run_algo(config->algo, &state);
free(state.kd_buf);
+ diff_result_plus_lines(result, print_plus_lines);
+
return result;
}
ARRAYLIST_FREE(result->chunks);
free(result);
}
+
+
+void diff_result_plus_lines(const struct diff_result *result,
+ void(*plus_lines_cb)(unsigned int first_atom_idx, unsigned int atoms))
+{
+ struct diff_chunk *c;
+ ARRAYLIST_FOREACH(c, result->chunks) {
+ if (c->left_count)
+ continue;
+ if (!c->right_count)
+ continue;
+ plus_lines_cb(diff_atom_root_idx(c->right_start->root, c->right_start), c->right_count);
+ }
+}