commit 41ff30f35eb8d2ee0688753ce9be23cb2727b92a from: Neels Hofmeyr date: Sun Oct 11 03:49:05 2020 UTC cosmetic: diff_algo_none(): rename to equal_lines_start commit - 467a993dc1da672ac3093104cbeae0dc22f978f9 commit + 41ff30f35eb8d2ee0688753ce9be23cb2727b92a blob - 82a44b8c680bcf2c6693dcaa405869824ac95696 blob + e1c91e207ea111f2b335b80d5614b68e6413b480 --- lib/diff_main.c +++ lib/diff_main.c @@ -363,44 +363,44 @@ diff_algo_none(const struct diff_algo_config *algo_con unsigned int l_len = state->left.atoms.len; struct diff_atom *r = state->right.atoms.head; unsigned int r_len = state->right.atoms.len; - unsigned int equal_atoms = 0; + unsigned int equal_atoms_start = 0; - while (equal_atoms < l_len - && equal_atoms < r_len) { + while (equal_atoms_start < l_len + && equal_atoms_start < r_len) { int err; bool same; - err = diff_atom_same(&same, &l[equal_atoms], - &r[equal_atoms]); + err = diff_atom_same(&same, &l[equal_atoms_start], + &r[equal_atoms_start]); if (err) return err; if (!same) break; - equal_atoms++; + equal_atoms_start++; } - if (equal_atoms) { + if (equal_atoms_start) { if (!diff_state_add_chunk(state, true, &l[0], - equal_atoms, + equal_atoms_start, &r[0], - equal_atoms)) + equal_atoms_start)) return ENOMEM; } /* Add a "minus" chunk with all lines from the left. */ - if (equal_atoms < l_len) { + if (equal_atoms_start < l_len) { if (!diff_state_add_chunk(state, true, - &l[equal_atoms], - l_len - equal_atoms, + &l[equal_atoms_start], + l_len - equal_atoms_start, NULL, 0)) return ENOMEM; } /* Add a "plus" chunk with all lines from the right. */ - if (equal_atoms < r_len) { + if (equal_atoms_start < r_len) { if (!diff_state_add_chunk(state, true, NULL, 0, - &r[equal_atoms], - r_len - equal_atoms)) + &r[equal_atoms_start], + r_len - equal_atoms_start)) return ENOMEM; } return DIFF_RC_OK;