index : pacman | |
Archlinux32 fork of pacman | gitolite user |
summaryrefslogtreecommitdiff |
author | Andrew Gregory <andrew.gregory.8@gmail.com> | 2013-02-19 19:41:39 -0500 |
---|---|---|
committer | Allan McRae <allan@archlinux.org> | 2013-02-24 13:11:54 +1000 |
commit | 19754b34a36203266c4e02f29178084c77282efd (patch) | |
tree | b08b873b0f1ccc5b5b382a6c55f7925b31968561 /lib/libalpm/filelist.c | |
parent | 083ac51816323d69fcf2e271ccd52add3cdd6d22 (diff) |
-rw-r--r-- | lib/libalpm/filelist.c | 15 |
diff --git a/lib/libalpm/filelist.c b/lib/libalpm/filelist.c index b0dcee4e..6a24903d 100644 --- a/lib/libalpm/filelist.c +++ b/lib/libalpm/filelist.c @@ -324,10 +324,10 @@ int _alpm_files_cmp(const void *f1, const void *f2) } -alpm_file_t *alpm_filelist_contains(alpm_filelist_t *filelist, +char *alpm_filelist_contains(alpm_filelist_t *filelist, const char *path) { - alpm_file_t key; + alpm_file_t key, *match; if(!filelist) { return NULL; @@ -335,8 +335,17 @@ alpm_file_t *alpm_filelist_contains(alpm_filelist_t *filelist, key.name = (char *)path; - return bsearch(&key, filelist->files, filelist->count, + match = bsearch(&key, filelist->files, filelist->count, sizeof(alpm_file_t), _alpm_files_cmp); + + if(match) { + return match->name; + } else if(filelist->resolved_path) { + return bsearch(&path, filelist->resolved_path, filelist->count, + sizeof(char *), _alpm_filelist_strcmp); + } else { + return NULL; + } } /* vim: set ts=2 sw=2 noet: */ |