Commit 0cbbdc26 by Kirill A. Shutemov Committed by Vicent Marti

tree: fix cast warnings

/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 <kirill@shutemov.name>
parent 2ba222c5
......@@ -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");
......
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