xbps-bin: simplify pkgname_from_pkgmatch() and fix a bug.

--HG--
extra : convert_revision : xtraeme%40gmail.com-20100114123917-3tvrb3tp097nnq8r
This commit is contained in:
Juan RP 2010-01-14 13:39:17 +01:00
parent 7230203be4
commit 6c27794c5b

View File

@ -323,7 +323,6 @@ static char *
pkgname_from_pkgmatch(const char *pkg)
{
const char *version;
char *pkgname = NULL;
/*
* Check if 'pkg' string is a pkgmatch valid pattern or it
@ -333,13 +332,12 @@ pkgname_from_pkgmatch(const char *pkg)
*/
if ((version = xbps_get_pkgdep_version(pkg))) {
while (*version) {
if (isdigit((unsigned char)*version)) {
if (!isdigit((unsigned char)*version)) {
version++;
continue;
}
if (xbps_cmpver("0", version) <= 0)
pkgname = xbps_get_pkgdep_name(pkg);
break;
return xbps_get_pkgdep_name(pkg);
}
}
if ((version = xbps_get_pkg_version(pkg))) {
@ -369,12 +367,11 @@ pkgname_from_pkgmatch(const char *pkg)
break;
if (xbps_cmpver("0", version) <= 0)
pkgname = xbps_get_pkg_name(pkg);
break;
return xbps_get_pkg_name(pkg);
}
}
return pkgname;
return NULL;
}
int