From: Jacques Germishuys Date: Thu, 10 Apr 2014 10:44:51 +0000 (+0200) Subject: Fix const-correctness of git_patch_get_delta, git_patch_num_hunks, git_patch_num_line... X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=7a28f268adc1d2569ce504147af05834ae94c01a;p=libgit2.git Fix const-correctness of git_patch_get_delta, git_patch_num_hunks, git_patch_num_lines_in_hunk --- diff --git a/include/git2/patch.h b/include/git2/patch.h index f5ec682c6..47c395669 100644 --- a/include/git2/patch.h +++ b/include/git2/patch.h @@ -141,12 +141,12 @@ GIT_EXTERN(void) git_patch_free(git_patch *patch); /** * Get the delta associated with a patch */ -GIT_EXTERN(const git_diff_delta *) git_patch_get_delta(git_patch *patch); +GIT_EXTERN(const git_diff_delta *) git_patch_get_delta(const git_patch *patch); /** * Get the number of hunks in a patch */ -GIT_EXTERN(size_t) git_patch_num_hunks(git_patch *patch); +GIT_EXTERN(size_t) git_patch_num_hunks(const git_patch *patch); /** * Get line counts of each type in a patch. @@ -197,7 +197,7 @@ GIT_EXTERN(int) git_patch_get_hunk( * @return Number of lines in hunk or -1 if invalid hunk index */ GIT_EXTERN(int) git_patch_num_lines_in_hunk( - git_patch *patch, + const git_patch *patch, size_t hunk_idx); /** diff --git a/src/diff_patch.c b/src/diff_patch.c index dd8b73938..38d5f4257 100644 --- a/src/diff_patch.c +++ b/src/diff_patch.c @@ -631,13 +631,13 @@ void git_patch_free(git_patch *patch) GIT_REFCOUNT_DEC(patch, diff_patch_free); } -const git_diff_delta *git_patch_get_delta(git_patch *patch) +const git_diff_delta *git_patch_get_delta(const git_patch *patch) { assert(patch); return patch->delta; } -size_t git_patch_num_hunks(git_patch *patch) +size_t git_patch_num_hunks(const git_patch *patch) { assert(patch); return git_array_size(patch->hunks); @@ -708,7 +708,7 @@ int git_patch_get_hunk( return 0; } -int git_patch_num_lines_in_hunk(git_patch *patch, size_t hunk_idx) +int git_patch_num_lines_in_hunk(const git_patch *patch, size_t hunk_idx) { diff_patch_hunk *hunk; assert(patch);