xbps_pkg_version: minor optimization.

This commit is contained in:
Juan RP 2014-11-18 16:11:43 +01:00
parent 83d00e4e8c
commit c549252223

View File

@ -89,7 +89,6 @@ const char *
xbps_pkg_version(const char *pkg)
{
const char *p;
bool valid = false;
if ((p = strrchr(pkg, '-')) == NULL)
return NULL;
@ -98,14 +97,10 @@ xbps_pkg_version(const char *pkg)
if (p[i] == '_')
break;
if (isdigit((unsigned char)p[i]) && strchr(p, '_')) {
valid = true;
break;
return p + 1; /* skip first '-' */
}
}
if (!valid)
return NULL;
return p + 1; /* skip first '-' */
return NULL;
}
char *