diff options
author | Patrick Steinhardt <ps@pks.im> | 2018-12-01 08:59:24 +0100 |
---|---|---|
committer | Patrick Steinhardt <ps@pks.im> | 2019-02-15 13:16:48 +0100 |
commit | c50a8ac2c734e4301223e39e4ddce98e6c368294 (patch) | |
tree | 85ad3a57e06b9405e7b525d4ca361cf9c137e7fd /src/apply.c | |
parent | 84a089da3701db370b2c77e6866abe3a5065c542 (diff) | |
download | libgit2-c50a8ac2c734e4301223e39e4ddce98e6c368294.tar.gz |
maps: use high-level function to check existence of keys
Some callers were still using the tightly-coupled pattern of `lookup_index` and
`valid_index` to verify that an entry exists in a map. Instead, use the more
high-level `exists` functions to decouple map users from its implementation.
Diffstat (limited to 'src/apply.c')
-rw-r--r-- | src/apply.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/src/apply.c b/src/apply.c index 4b7eedd90..ad8ce2f1b 100644 --- a/src/apply.c +++ b/src/apply.c @@ -439,7 +439,6 @@ static int apply_one( git_filemode_t pre_filemode; git_index_entry pre_entry, post_entry; bool skip_preimage = false; - size_t pos; int error; if ((error = git_patch_from_diff(&patch, diff, i)) < 0) @@ -464,8 +463,7 @@ static int apply_one( */ if (delta->status != GIT_DELTA_RENAMED && delta->status != GIT_DELTA_ADDED) { - pos = git_strmap_lookup_index(removed_paths, delta->old_file.path); - if (git_strmap_valid_index(removed_paths, pos)) { + if (git_strmap_exists(removed_paths, delta->old_file.path)) { error = apply_err("path '%s' has been renamed or deleted", delta->old_file.path); goto done; } |