diff options
author | Russell Belfer <arrbee@arrbee.com> | 2012-03-05 09:14:56 -0800 |
---|---|---|
committer | Russell Belfer <rb@github.com> | 2012-05-02 15:36:33 -0700 |
commit | 8b2bcfbe68ea9cb8f30018cc2607c9409ecf0fc0 (patch) | |
tree | 3831b302c0a4fb3fa4d416a6063f13e8f4c12704 /src/diff_output.c | |
parent | 16b83019af63d837b6934bcf1b71b8697d5d94c8 (diff) | |
download | libgit2-8b2bcfbe68ea9cb8f30018cc2607c9409ecf0fc0.tar.gz |
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.
Diffstat (limited to 'src/diff_output.c')
-rw-r--r-- | src/diff_output.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/diff_output.c b/src/diff_output.c index a6d75f60f..ee18ea6e7 100644 --- a/src/diff_output.c +++ b/src/diff_output.c @@ -316,6 +316,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 && (diff->opts.flags & GIT_DIFF_INCLUDE_UNMODIFIED) == 0) @@ -418,8 +419,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: |