Commit Diff


commit - 484d974bd6540464db217df140323b4aab4086c3
commit + 2becf66303998fe848514443a3c998e26ea86e8e
blob - 6855889d9612f734106a574e7b7ff947b56823d5
blob + 46bbadf3cb6493dd4afd224d56cf96436b9194d6
--- lib/diff_internal.h
+++ lib/diff_internal.h
@@ -148,8 +148,7 @@ int diff_output_trailing_newline_msg(struct diff_outpu
 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
@@ -263,19 +263,17 @@ is_function_prototype(unsigned char ch)
 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
@@ -237,7 +237,7 @@ output_unidiff_chunk(struct diff_output_info *outinfo,
 		     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;
@@ -304,7 +304,7 @@ output_unidiff_chunk(struct diff_output_info *outinfo,
 	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;
 	}
@@ -433,7 +433,7 @@ diff_output_unidiff_chunk(struct diff_output_info **ou
 	}
 
 	return output_unidiff_chunk(outinfo, dest, state, info,
-	    result, false, show_function_prototypes, cc, 0);
+	    result, false, show_function_prototypes, cc);
 }
 
 int
@@ -586,7 +586,7 @@ diff_output_unidiff(struct diff_output_info **output_i
 		      " 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);
@@ -594,7 +594,7 @@ diff_output_unidiff(struct diff_output_info **output_i
 
 	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;
 }