1
0
mirror of https://github.com/moparisthebest/pacman synced 2024-12-22 15:58:50 -05:00

Remove wrapper call around versioncmp

Actually, just rename _alpm_versioncmp to alpm_pkg_vercmp and get rid of the
need for a wrapper since it did nothing anyway.

Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
Dan McGee 2008-05-14 00:37:51 -05:00
parent 8428367285
commit a8ee185413
5 changed files with 5 additions and 19 deletions

View File

@ -72,7 +72,7 @@ int _alpm_add_loadtarget(pmtrans_t *trans, pmdb_t *db, char *name)
for(i = trans->packages; i; i = i->next) { for(i = trans->packages; i; i = i->next) {
pmpkg_t *transpkg = i->data; pmpkg_t *transpkg = i->data;
if(strcmp(transpkg->name, pkgname) == 0) { if(strcmp(transpkg->name, pkgname) == 0) {
if(_alpm_versioncmp(transpkg->version, pkgver) < 0) { if(alpm_pkg_vercmp(transpkg->version, pkgver) < 0) {
_alpm_log(PM_LOG_WARNING, _("replacing older version %s-%s by %s in target list\n"), _alpm_log(PM_LOG_WARNING, _("replacing older version %s-%s by %s in target list\n"),
transpkg->name, transpkg->version, pkgver); transpkg->name, transpkg->version, pkgver);
_alpm_pkg_free(i->data); _alpm_pkg_free(i->data);

View File

@ -188,7 +188,7 @@ int alpm_pkg_load(const char *filename, unsigned short full, pmpkg_t **pkg);
int alpm_pkg_free(pmpkg_t *pkg); int alpm_pkg_free(pmpkg_t *pkg);
int alpm_pkg_checkmd5sum(pmpkg_t *pkg); int alpm_pkg_checkmd5sum(pmpkg_t *pkg);
char *alpm_fetch_pkgurl(const char *url); char *alpm_fetch_pkgurl(const char *url);
int alpm_pkg_vercmp(const char *ver1, const char *ver2); int alpm_pkg_vercmp(const char *a, const char *b);
alpm_list_t *alpm_pkg_compute_requiredby(pmpkg_t *pkg); alpm_list_t *alpm_pkg_compute_requiredby(pmpkg_t *pkg);
const char *alpm_pkg_get_filename(pmpkg_t *pkg); const char *alpm_pkg_get_filename(pmpkg_t *pkg);

View File

@ -339,7 +339,7 @@ static int dep_vercmp(const char *version1, pmdepmod_t mod,
if(mod == PM_DEP_MOD_ANY) { if(mod == PM_DEP_MOD_ANY) {
equal = 1; equal = 1;
} else { } else {
int cmp = _alpm_versioncmp(version1, version2); int cmp = alpm_pkg_vercmp(version1, version2);
switch(mod) { switch(mod) {
case PM_DEP_MOD_EQ: equal = (cmp == 0); break; case PM_DEP_MOD_EQ: equal = (cmp == 0); break;
case PM_DEP_MOD_GE: equal = (cmp >= 0); break; case PM_DEP_MOD_GE: equal = (cmp >= 0); break;

View File

@ -100,19 +100,6 @@ int SYMEXPORT alpm_pkg_checkmd5sum(pmpkg_t *pkg)
return(retval); return(retval);
} }
/** Compare versions.
* @param ver1 first version
* @param ver2 secont version
* @return postive, 0 or negative if ver1 is less, equal or more
* than ver2, respectively.
*/
int SYMEXPORT alpm_pkg_vercmp(const char *ver1, const char *ver2)
{
ALPM_LOG_FUNC;
return(_alpm_versioncmp(ver1, ver2));
}
const char SYMEXPORT *alpm_pkg_get_filename(pmpkg_t *pkg) const char SYMEXPORT *alpm_pkg_get_filename(pmpkg_t *pkg)
{ {
ALPM_LOG_FUNC; ALPM_LOG_FUNC;
@ -591,7 +578,7 @@ alpm_list_t SYMEXPORT *alpm_pkg_compute_requiredby(pmpkg_t *pkg)
* version 4.4.2.3. Small modifications have been made to make it more * version 4.4.2.3. Small modifications have been made to make it more
* consistent with the libalpm coding style. * consistent with the libalpm coding style.
*/ */
int _alpm_versioncmp(const char *a, const char *b) int SYMEXPORT alpm_pkg_vercmp(const char *a, const char *b)
{ {
char oldch1, oldch2; char oldch1, oldch2;
char *str1, *str2; char *str1, *str2;
@ -843,7 +830,7 @@ int _alpm_pkg_compare_versions(pmpkg_t *local_pkg, pmpkg_t *pkg)
} }
/* compare versions and see if we need to upgrade */ /* compare versions and see if we need to upgrade */
cmp = _alpm_versioncmp(alpm_pkg_get_version(pkg), alpm_pkg_get_version(local_pkg)); cmp = alpm_pkg_vercmp(alpm_pkg_get_version(pkg), alpm_pkg_get_version(local_pkg));
if(cmp != 0 && pkg->force) { if(cmp != 0 && pkg->force) {
cmp = 1; cmp = 1;

View File

@ -74,7 +74,6 @@ struct __pmpkg_t {
alpm_list_t *delta_path; alpm_list_t *delta_path;
}; };
int _alpm_versioncmp(const char *a, const char *b);
pmpkg_t* _alpm_pkg_new(void); pmpkg_t* _alpm_pkg_new(void);
pmpkg_t *_alpm_pkg_dup(pmpkg_t *pkg); pmpkg_t *_alpm_pkg_dup(pmpkg_t *pkg);
void _alpm_pkg_free(pmpkg_t *pkg); void _alpm_pkg_free(pmpkg_t *pkg);