projects
/
apt.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
* Swedish translation update. Closes: #592366
[apt.git]
/
apt-pkg
/
versionmatch.cc
diff --git
a/apt-pkg/versionmatch.cc
b/apt-pkg/versionmatch.cc
index 72c9bff2d4ac509608a88997addc09a565c3e139..093180f9b78e2f9d9397eed1e39b3e191fa52626 100644
(file)
--- a/
apt-pkg/versionmatch.cc
+++ b/
apt-pkg/versionmatch.cc
@@
-155,6
+155,8
@@
pkgCache::VerIterator pkgVersionMatch::Find(pkgCache::PkgIterator Pkg)
{
if (MatchVer(Ver.VerStr(),VerStr,VerPrefixMatch) == true)
return Ver;
{
if (MatchVer(Ver.VerStr(),VerStr,VerPrefixMatch) == true)
return Ver;
+ if (ExpressionMatches(VerStr, Ver.VerStr()) == true)
+ return Ver;
continue;
}
continue;
}
@@
-173,7
+175,6
@@
pkgCache::VerIterator pkgVersionMatch::Find(pkgCache::PkgIterator Pkg)
bool pkgVersionMatch::ExpressionMatches(const char *pattern, const char *string)
{
bool pkgVersionMatch::ExpressionMatches(const char *pattern, const char *string)
{
- std::cerr << "MATCH " << pattern;
if (pattern[0] == '/') {
bool res = false;
size_t length = strlen(pattern);
if (pattern[0] == '/') {
bool res = false;
size_t length = strlen(pattern);
@@
-182,11
+183,12
@@
bool pkgVersionMatch::ExpressionMatches(const char *pattern, const char *string)
char *regex = strdup(pattern + 1);
regex[length - 2] = '\0';
if (regcomp(&preg, regex, REG_EXTENDED | REG_ICASE) != 0) {
char *regex = strdup(pattern + 1);
regex[length - 2] = '\0';
if (regcomp(&preg, regex, REG_EXTENDED | REG_ICASE) != 0) {
-
std::cerr << "E: Invalid regular expression: " << regex << "\n"
;
+
_error->Warning("Invalid regular expression: %s", regex)
;
} else if (regexec(&preg, string, 0, NULL, 0) == 0) {
res = true;
}
free(regex);
} else if (regexec(&preg, string, 0, NULL, 0) == 0) {
res = true;
}
free(regex);
+ regfree(&preg);
return res;
}
}
return res;
}
}