commit - 501e780790ed4cd0aa9e3404e28e0204de28c9fc
commit + f8cbb8fea02ccfaa3581f70556d4670b88ce2b0d
blob - 672b15f7a6ce193952dd1f861a1eda057217c2d1
blob + 46bb7f527a44e83d238f01ff2980caf8ce2cd5e2
--- 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;
-}