commit - 692a4bb1222d6b7c94768d7305a2178a15b05887
commit + db3ca9d5a521667bc62fde71fe53aa595a0b0747
blob - 6855889d9612f734106a574e7b7ff947b56823d5
blob + 46bbadf3cb6493dd4afd224d56cf96436b9194d6
--- lib/diff_internal.h
+++ lib/diff_internal.h
int diff_output_match_function_prototype(char *prototype, size_t prototype_size,
int *last_prototype_idx,
const struct diff_result *result,
- const struct diff_chunk_context *cc,
- unsigned int ncontext);
+ const struct diff_chunk_context *cc);
struct diff_output_info *diff_output_info_alloc(void);
blob - f44e799638f771a0588c11e3d5b6b1200b5c64f1
blob + 7ac63bb6c433b17070e64af301c8039c4a1aefbe
--- lib/diff_output.c
+++ lib/diff_output.c
int
diff_output_match_function_prototype(char *prototype, size_t prototype_size,
int *last_prototype_idx, const struct diff_result *result,
- const struct diff_chunk_context *cc, unsigned int ncontext)
+ const struct diff_chunk_context *cc)
{
struct diff_atom *start_atom, *atom;
const struct diff_data *data;
unsigned char buf[DIFF_FUNCTION_CONTEXT_SIZE];
const char *state = NULL;
- int rc, i, ch, idx;
-
- idx = MIN(cc->left.start + (ncontext ? ncontext : 0), cc->left.end - 1);
+ int rc, i, ch;
if (result->left->atoms.len > 0 && cc->left.start > 0) {
data = result->left;
- start_atom = &data->atoms.head[idx];
+ start_atom = &data->atoms.head[cc->left.start - 1];
} else
return DIFF_RC_OK;
blob - 4757099644a9c1eec21e1af9102ba13ba417d609
blob + 9b8e02dc9f20f06d14deba7d2ac739a0a2f8f20a
--- lib/diff_output_unidiff.c
+++ lib/diff_output_unidiff.c
const struct diff_input_info *info,
const struct diff_result *result,
bool print_header, bool show_function_prototypes,
- const struct diff_chunk_context *cc, unsigned int ncontext)
+ const struct diff_chunk_context *cc)
{
int rc, left_start, left_len, right_start, right_len;
off_t outoff = 0, *offp;
if (show_function_prototypes) {
rc = diff_output_match_function_prototype(state->prototype,
sizeof(state->prototype), &state->last_prototype_idx,
- result, cc, ncontext);
+ result, cc);
if (rc)
return rc;
}
}
return output_unidiff_chunk(outinfo, dest, state, info,
- result, false, show_function_prototypes, cc, 0);
+ result, false, show_function_prototypes, cc);
}
int
" print left %d-%d right %d-%d\n",
cc.left.start, cc.left.end, cc.right.start, cc.right.end);
output_unidiff_chunk(outinfo, dest, state, info, result,
- true, show_function_prototypes, &cc, context_lines);
+ true, show_function_prototypes, &cc);
cc = next;
debug("new unprinted chunk is left %d-%d right %d-%d\n",
cc.left.start, cc.left.end, cc.right.start, cc.right.end);
if (!diff_chunk_context_empty(&cc))
output_unidiff_chunk(outinfo, dest, state, info, result,
- true, show_function_prototypes, &cc, context_lines);
+ true, show_function_prototypes, &cc);
diff_output_unidiff_state_free(state);
return DIFF_RC_OK;
}