From a8ee1854135f333091337e3dbcb1f96cdb1aab01 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Wed, 14 May 2008 00:37:51 -0500 Subject: [PATCH] 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 --- lib/libalpm/add.c | 2 +- lib/libalpm/alpm.h | 2 +- lib/libalpm/deps.c | 2 +- lib/libalpm/package.c | 17 ++--------------- lib/libalpm/package.h | 1 - 5 files changed, 5 insertions(+), 19 deletions(-) diff --git a/lib/libalpm/add.c b/lib/libalpm/add.c index b8d76792..a8249c40 100644 --- a/lib/libalpm/add.c +++ b/lib/libalpm/add.c @@ -72,7 +72,7 @@ int _alpm_add_loadtarget(pmtrans_t *trans, pmdb_t *db, char *name) for(i = trans->packages; i; i = i->next) { pmpkg_t *transpkg = i->data; 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"), transpkg->name, transpkg->version, pkgver); _alpm_pkg_free(i->data); diff --git a/lib/libalpm/alpm.h b/lib/libalpm/alpm.h index 7cef2abc..4720b222 100644 --- a/lib/libalpm/alpm.h +++ b/lib/libalpm/alpm.h @@ -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_checkmd5sum(pmpkg_t *pkg); 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); const char *alpm_pkg_get_filename(pmpkg_t *pkg); diff --git a/lib/libalpm/deps.c b/lib/libalpm/deps.c index 55e24388..37e99162 100644 --- a/lib/libalpm/deps.c +++ b/lib/libalpm/deps.c @@ -339,7 +339,7 @@ static int dep_vercmp(const char *version1, pmdepmod_t mod, if(mod == PM_DEP_MOD_ANY) { equal = 1; } else { - int cmp = _alpm_versioncmp(version1, version2); + int cmp = alpm_pkg_vercmp(version1, version2); switch(mod) { case PM_DEP_MOD_EQ: equal = (cmp == 0); break; case PM_DEP_MOD_GE: equal = (cmp >= 0); break; diff --git a/lib/libalpm/package.c b/lib/libalpm/package.c index 0b2bf6d1..07b5fa38 100644 --- a/lib/libalpm/package.c +++ b/lib/libalpm/package.c @@ -100,19 +100,6 @@ int SYMEXPORT alpm_pkg_checkmd5sum(pmpkg_t *pkg) 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) { 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 * 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 *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 */ - 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) { cmp = 1; diff --git a/lib/libalpm/package.h b/lib/libalpm/package.h index ccb1c3b6..ddf1d073 100644 --- a/lib/libalpm/package.h +++ b/lib/libalpm/package.h @@ -74,7 +74,6 @@ struct __pmpkg_t { alpm_list_t *delta_path; }; -int _alpm_versioncmp(const char *a, const char *b); pmpkg_t* _alpm_pkg_new(void); pmpkg_t *_alpm_pkg_dup(pmpkg_t *pkg); void _alpm_pkg_free(pmpkg_t *pkg);