From 0cbbdc26a975ef73bba1f7161bd9c7313d5cab24 Mon Sep 17 00:00:00 2001 From: "Kirill A. Shutemov" Date: Fri, 15 Jul 2011 17:56:48 +0300 Subject: [PATCH] tree: fix cast warnings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit /home/kas/git/public/libgit2/src/tree.c: In function ‘entry_search_cmp’: /home/kas/git/public/libgit2/src/tree.c:47:36: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual] /home/kas/git/public/libgit2/src/tree.c: In function ‘git_treebuilder_remove’: /home/kas/git/public/libgit2/src/tree.c:443:31: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual] Signed-off-by: Kirill A. Shutemov --- src/tree.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/tree.c b/src/tree.c index 975d36a70..8e370667d 100644 --- a/src/tree.c +++ b/src/tree.c @@ -44,8 +44,8 @@ struct tree_key_search { int entry_search_cmp(const void *key, const void *array_member) { - struct tree_key_search *ksearch = (struct tree_key_search *)key; - const git_tree_entry *entry = (const git_tree_entry *)(array_member); + const struct tree_key_search *ksearch = key; + const git_tree_entry *entry = array_member; int result = git_futils_cmp_path( @@ -415,7 +415,7 @@ int git_treebuilder_insert(git_tree_entry **entry_out, git_treebuilder *bld, con return GIT_SUCCESS; } -const git_tree_entry *git_treebuilder_get(git_treebuilder *bld, const char *filename) +static git_tree_entry *treebuilder_get(git_treebuilder *bld, const char *filename) { int idx; git_tree_entry *entry; @@ -438,9 +438,14 @@ const git_tree_entry *git_treebuilder_get(git_treebuilder *bld, const char *file return entry; } +const git_tree_entry *git_treebuilder_get(git_treebuilder *bld, const char *filename) +{ + return treebuilder_get(bld, filename); +} + int git_treebuilder_remove(git_treebuilder *bld, const char *filename) { - git_tree_entry *remove_ptr = (git_tree_entry *)git_treebuilder_get(bld, filename); + git_tree_entry *remove_ptr = treebuilder_get(bld, filename); if (remove_ptr == NULL || remove_ptr->removed) return git__throw(GIT_ENOTFOUND, "Failed to remove entry. File isn't in the tree");