commit - cba7b80d0c90671f731cb6a242cd9dc6d3853a97
commit + d0a628e3806179efc9a1bb53342391c3c92d6a9d
blob - a1d702831e621f5740cbf492a9a032fb1fde989a
blob + b343617f463879fda7cf9cdf9f98c0af4af65f9c
--- diff/diff.c
+++ diff/diff.c
.left_path = file1,
.right_path = file2,
};
+ struct diff_result *result;
+ enum diff_rc rc;
str1 = mmapfile(file1, &st1);
str2 = mmapfile(file2, &st2);
- diff_unidiff(stdout, &diff_config, &info, str1, st1.st_size, str2, st2.st_size, 3);
+ result = diff_main(&diff_config, str1, st1.st_size, str2, st2.st_size);
+#if 0
+ rc = diff_output_plain(stdout, &info, result);
+#else
+ rc = diff_output_unidiff(stdout, &info, result, 3);
+#endif
+ diff_result_free(result);
munmap(str1, st1.st_size);
munmap(str2, st2.st_size);
- return 0;
+ return rc;
}
char *
blob - 6981d494b1cf990c4ab4dcc08aa1dd2fcf9e9e38
blob + b229f4cceee81ddba11ecdfeacbfa29bd4ccf721
--- include/diff/diff_output.h
+++ include/diff/diff_output.h
enum diff_rc diff_output_plain(FILE *dest, const struct diff_input_info *info,
const struct diff_result *result);
-enum diff_rc diff_plain(FILE *dest, const struct diff_config *diff_config,
- const struct diff_input_info *info,
- const char *left, int left_len, const char *right, int right_len);
-
enum diff_rc diff_output_unidiff(FILE *dest, const struct diff_input_info *info,
const struct diff_result *result, unsigned int context_lines);
-enum diff_rc diff_unidiff(FILE *dest, const struct diff_config *diff_config,
- const struct diff_input_info *info,
- const char *left, int left_len, const char *right, int right_len,
- unsigned int context_lines);
-
enum diff_rc diff_output_info(FILE *dest, const struct diff_input_info *info);
void diff_output_lines(FILE *dest, const char *prefix, struct diff_atom *start_atom, unsigned int count);
blob - d8f61ff77eef405b021f593b8318945d4009d855
blob + 55564fe485f024584b4094a4d203cd057b93ea1b
--- lib/diff_output_plain.c
+++ lib/diff_output_plain.c
}
return DIFF_RC_OK;
}
-
-enum diff_rc diff_plain(FILE *dest, const struct diff_config *diff_config,
- const struct diff_input_info *info,
- const char *left, int left_len, const char *right, int right_len)
-{
- enum diff_rc rc;
- left_len = left_len < 0 ? strlen(left) : left_len;
- right_len = right_len < 0 ? strlen(right) : right_len;
- struct diff_result *result = diff_main(diff_config, left, left_len, right, right_len);
- rc = diff_output_plain(dest, info, result);
- diff_result_free(result);
- return rc;
-}
blob - 88af78d02c8b9ea34cd771d45cb8b465fa9982c9
blob + 40cc34ebd59e457c7dd39671b0abd49f24937a19
--- lib/diff_output_unidiff.c
+++ lib/diff_output_unidiff.c
diff_output_unidiff_chunk(dest, &header_printed, info, result, &cc);
return DIFF_RC_OK;
}
-
-enum diff_rc diff_unidiff(FILE *dest, const struct diff_config *diff_config,
- const struct diff_input_info *info,
- const char *left, int left_len, const char *right, int right_len,
- unsigned int context_lines)
-{
- enum diff_rc rc;
- left_len = left_len < 0 ? strlen(left) : left_len;
- right_len = right_len < 0 ? strlen(right) : right_len;
- struct diff_result *result = diff_main(diff_config, left, left_len, right, right_len);
- rc = diff_output_unidiff(dest, info, result, context_lines);
- diff_result_free(result);
- return rc;
-}