Avoid netshared path matching when netshared path is not set

- We've been calling matchNetsharedpath() for every single file in
  the transaction regardless of whether %{_netsharedpath} is set or
  not (and almost always it is not), meaning lots of pointless
  strlen() calls and in case of erasure, rpmfi iterations performed.
  Not exactly a massive speedup but a speedup nevertheless.
This commit is contained in:
Panu Matilainen 2012-09-03 15:03:12 +03:00
parent d5dc69c18e
commit e663722a79
1 changed files with 15 additions and 11 deletions

View File

@ -699,12 +699,14 @@ static void skipEraseFiles(const rpmts ts, rpmte p)
* Net shared paths are not relative to the current root (though
* they do need to take package relocations into account).
*/
fi = rpmfiInit(fi, 0);
while ((i = rpmfiNext(fi)) >= 0)
{
nsp = matchNetsharedpath(ts, fi);
if (nsp && *nsp) {
rpmfsSetAction(fs, i, FA_SKIPNETSHARED);
if (ts->netsharedPaths) {
fi = rpmfiInit(fi, 0);
while ((i = rpmfiNext(fi)) >= 0)
{
nsp = matchNetsharedpath(ts, fi);
if (nsp && *nsp) {
rpmfsSetAction(fs, i, FA_SKIPNETSHARED);
}
}
}
}
@ -763,11 +765,13 @@ static void skipInstallFiles(const rpmts ts, rpmte p)
* Net shared paths are not relative to the current root (though
* they do need to take package relocations into account).
*/
nsp = matchNetsharedpath(ts, fi);
if (nsp && *nsp) {
drc[ix]--; dff[ix] = 1;
rpmfsSetAction(fs, i, FA_SKIPNETSHARED);
continue;
if (ts->netsharedPaths) {
nsp = matchNetsharedpath(ts, fi);
if (nsp && *nsp) {
drc[ix]--; dff[ix] = 1;
rpmfsSetAction(fs, i, FA_SKIPNETSHARED);
continue;
}
}
/*