Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/lib/libalpm/deps.c
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2011-08-18 00:11:19 -0500
committerDan McGee <dan@archlinux.org>2011-08-18 10:47:41 -0500
commitd008a816f1125ca44f0b2165b38220047860ecb0 (patch)
treedba30fd6730c3ced823d45723f85f3c7bed0efee /lib/libalpm/deps.c
parent78b63ce7c30f4a20707bce61eeaef913b513f557 (diff)
Add an _alpm_depcmp_literal() function
This omits the finding of matching provisions and only checks the package itself against the provided dep. Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'lib/libalpm/deps.c')
-rw-r--r--lib/libalpm/deps.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/lib/libalpm/deps.c b/lib/libalpm/deps.c
index de9ae44c..48e8e773 100644
--- a/lib/libalpm/deps.c
+++ b/lib/libalpm/deps.c
@@ -368,20 +368,23 @@ static int dep_vercmp(const char *version1, alpm_depmod_t mod,
return equal;
}
+int _alpm_depcmp_literal(alpm_pkg_t *pkg, alpm_depend_t *dep)
+{
+ if(pkg->name_hash != dep->name_hash
+ || strcmp(pkg->name, dep->name) != 0) {
+ /* skip more expensive checks */
+ return 0;
+ }
+ return dep_vercmp(pkg->version, dep->mod, dep->version);
+}
+
int _alpm_depcmp(alpm_pkg_t *pkg, alpm_depend_t *dep)
{
alpm_list_t *i;
- int satisfy = 0;
+ int satisfy = _alpm_depcmp_literal(pkg, dep);
- /* check (pkg->name, pkg->version) */
- if(pkg->name_hash != dep->name_hash) {
- /* skip more expensive checks */
- } else {
- satisfy = (strcmp(pkg->name, dep->name) == 0
- && dep_vercmp(pkg->version, dep->mod, dep->version));
- if(satisfy) {
- return satisfy;
- }
+ if(satisfy) {
+ return satisfy;
}
/* check provisions, name and version if available */