Prefix alpm_depmod_t members with ALPM

Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
Allan McRae 2011-07-02 02:01:38 +10:00
parent eb39a9482b
commit f818f570c5
2 changed files with 28 additions and 28 deletions

View file

@ -63,17 +63,17 @@ typedef enum _alpm_pkgreason_t {
/** Types of version constraints in dependency specs. */ /** Types of version constraints in dependency specs. */
typedef enum _alpm_depmod_t { typedef enum _alpm_depmod_t {
/** No version constraint */ /** No version constraint */
PM_DEP_MOD_ANY = 1, ALPM_DEP_MOD_ANY = 1,
/** Test version equality (package=x.y.z) */ /** Test version equality (package=x.y.z) */
PM_DEP_MOD_EQ, ALPM_DEP_MOD_EQ,
/** Test for at least a version (package>=x.y.z) */ /** Test for at least a version (package>=x.y.z) */
PM_DEP_MOD_GE, ALPM_DEP_MOD_GE,
/** Test for at most a version (package<=x.y.z) */ /** Test for at most a version (package<=x.y.z) */
PM_DEP_MOD_LE, ALPM_DEP_MOD_LE,
/** Test for greater than some version (package>x.y.z) */ /** Test for greater than some version (package>x.y.z) */
PM_DEP_MOD_GT, ALPM_DEP_MOD_GT,
/** Test for less than some version (package<x.y.z) */ /** Test for less than some version (package<x.y.z) */
PM_DEP_MOD_LT ALPM_DEP_MOD_LT
} alpm_depmod_t; } alpm_depmod_t;
/** /**

View file

@ -213,7 +213,7 @@ static alpm_depend_t *filtered_depend(alpm_depend_t *dep, int nodepversion)
if(nodepversion) { if(nodepversion) {
alpm_depend_t *newdep = _alpm_dep_dup(dep); alpm_depend_t *newdep = _alpm_dep_dup(dep);
ASSERT(newdep, return dep); ASSERT(newdep, return dep);
newdep->mod = PM_DEP_MOD_ANY; newdep->mod = ALPM_DEP_MOD_ANY;
dep = newdep; dep = newdep;
} }
return dep; return dep;
@ -353,16 +353,16 @@ static int dep_vercmp(const char *version1, alpm_depmod_t mod,
{ {
int equal = 0; int equal = 0;
if(mod == PM_DEP_MOD_ANY) { if(mod == ALPM_DEP_MOD_ANY) {
equal = 1; equal = 1;
} else { } else {
int cmp = alpm_pkg_vercmp(version1, version2); int cmp = alpm_pkg_vercmp(version1, version2);
switch(mod) { switch(mod) {
case PM_DEP_MOD_EQ: equal = (cmp == 0); break; case ALPM_DEP_MOD_EQ: equal = (cmp == 0); break;
case PM_DEP_MOD_GE: equal = (cmp >= 0); break; case ALPM_DEP_MOD_GE: equal = (cmp >= 0); break;
case PM_DEP_MOD_LE: equal = (cmp <= 0); break; case ALPM_DEP_MOD_LE: equal = (cmp <= 0); break;
case PM_DEP_MOD_LT: equal = (cmp < 0); break; case ALPM_DEP_MOD_LT: equal = (cmp < 0); break;
case PM_DEP_MOD_GT: equal = (cmp > 0); break; case ALPM_DEP_MOD_GT: equal = (cmp > 0); break;
default: equal = 1; break; default: equal = 1; break;
} }
} }
@ -392,7 +392,7 @@ int _alpm_depcmp(alpm_pkg_t *pkg, alpm_depend_t *dep)
const char *provver = strchr(provision, '='); const char *provver = strchr(provision, '=');
if(provver == NULL) { /* no provision version */ if(provver == NULL) { /* no provision version */
satisfy = (dep->mod == PM_DEP_MOD_ANY satisfy = (dep->mod == ALPM_DEP_MOD_ANY
&& strcmp(provision, dep->name) == 0); && strcmp(provision, dep->name) == 0);
} else { } else {
/* This is a bit tricker than the old code for performance reasons. To /* This is a bit tricker than the old code for performance reasons. To
@ -425,24 +425,24 @@ alpm_depend_t *_alpm_splitdep(const char *depstring)
/* Find a version comparator if one exists. If it does, set the type and /* Find a version comparator if one exists. If it does, set the type and
* increment the ptr accordingly so we can copy the right strings. */ * increment the ptr accordingly so we can copy the right strings. */
if((ptr = strstr(depstring, ">="))) { if((ptr = strstr(depstring, ">="))) {
depend->mod = PM_DEP_MOD_GE; depend->mod = ALPM_DEP_MOD_GE;
version = ptr + 2; version = ptr + 2;
} else if((ptr = strstr(depstring, "<="))) { } else if((ptr = strstr(depstring, "<="))) {
depend->mod = PM_DEP_MOD_LE; depend->mod = ALPM_DEP_MOD_LE;
version = ptr + 2; version = ptr + 2;
} else if((ptr = strstr(depstring, "="))) { } else if((ptr = strstr(depstring, "="))) {
/* Note: we must do =,<,> checks after <=, >= checks */ /* Note: we must do =,<,> checks after <=, >= checks */
depend->mod = PM_DEP_MOD_EQ; depend->mod = ALPM_DEP_MOD_EQ;
version = ptr + 1; version = ptr + 1;
} else if((ptr = strstr(depstring, "<"))) { } else if((ptr = strstr(depstring, "<"))) {
depend->mod = PM_DEP_MOD_LT; depend->mod = ALPM_DEP_MOD_LT;
version = ptr + 1; version = ptr + 1;
} else if((ptr = strstr(depstring, ">"))) { } else if((ptr = strstr(depstring, ">"))) {
depend->mod = PM_DEP_MOD_GT; depend->mod = ALPM_DEP_MOD_GT;
version = ptr + 1; version = ptr + 1;
} else { } else {
/* no version specified, leave version and ptr NULL */ /* no version specified, leave version and ptr NULL */
depend->mod = PM_DEP_MOD_ANY; depend->mod = ALPM_DEP_MOD_ANY;
} }
/* copy the right parts to the right places */ /* copy the right parts to the right places */
@ -784,22 +784,22 @@ char SYMEXPORT *alpm_dep_compute_string(const alpm_depend_t *dep)
} }
switch(dep->mod) { switch(dep->mod) {
case PM_DEP_MOD_ANY: case ALPM_DEP_MOD_ANY:
opr = ""; opr = "";
break; break;
case PM_DEP_MOD_GE: case ALPM_DEP_MOD_GE:
opr = ">="; opr = ">=";
break; break;
case PM_DEP_MOD_LE: case ALPM_DEP_MOD_LE:
opr = "<="; opr = "<=";
break; break;
case PM_DEP_MOD_EQ: case ALPM_DEP_MOD_EQ:
opr = "="; opr = "=";
break; break;
case PM_DEP_MOD_LT: case ALPM_DEP_MOD_LT:
opr = "<"; opr = "<";
break; break;
case PM_DEP_MOD_GT: case ALPM_DEP_MOD_GT:
opr = ">"; opr = ">";
break; break;
default: default:
@ -807,14 +807,14 @@ char SYMEXPORT *alpm_dep_compute_string(const alpm_depend_t *dep)
break; break;
} }
if(dep->mod != PM_DEP_MOD_ANY && dep->version) { if(dep->mod != ALPM_DEP_MOD_ANY && dep->version) {
ver = dep->version; ver = dep->version;
} else { } else {
ver = ""; ver = "";
} }
/* we can always compute len and print the string like this because opr /* we can always compute len and print the string like this because opr
* and ver will be empty when PM_DEP_MOD_ANY is the depend type. the * and ver will be empty when ALPM_DEP_MOD_ANY is the depend type. the
* reassignments above also ensure we do not do a strlen(NULL). */ * reassignments above also ensure we do not do a strlen(NULL). */
len = strlen(name) + strlen(opr) + strlen(ver) + 1; len = strlen(name) + strlen(opr) + strlen(ver) + 1;
MALLOC(str, len, return NULL); MALLOC(str, len, return NULL);