Commit 28b486b2 by Russell Belfer

Copy values to avoid strict aliasing warning

To make this code more resilient to future changes, we'll
explicitly translate the libgit2 structure to the libxdiff
structure.
parent 2de60205
......@@ -308,6 +308,7 @@ int git_diff_foreach(
git_vector_foreach(&diff->deltas, info.index, delta) {
git_blob *old_blob = NULL, *new_blob = NULL;
git_map old_data, new_data;
mmfile_t old_xdiff_data, new_xdiff_data;
if (delta->status == GIT_DELTA_UNMODIFIED)
continue;
......@@ -409,8 +410,12 @@ int git_diff_foreach(
assert(hunk_cb || line_cb);
info.delta = delta;
old_xdiff_data.ptr = old_data.data;
old_xdiff_data.size = old_data.len;
new_xdiff_data.ptr = new_data.data;
new_xdiff_data.size = new_data.len;
xdl_diff((mmfile_t *)&old_data, (mmfile_t *)&new_data,
xdl_diff(&old_xdiff_data, &new_xdiff_data,
&xdiff_params, &xdiff_config, &xdiff_callback);
cleanup:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment