diff options
author | Zac Medico <zmedico@gentoo.org> | 2007-05-22 13:15:38 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2007-05-22 13:15:38 +0000 |
commit | 70993ee7fe1c3130c745c6c94c499b51c65f81d8 (patch) | |
tree | 9c6edd0e15849b74fe50c87355ac8cbca90de240 | |
parent | 75960eeba2f1078aa334b6510d04e52545acdf48 (diff) | |
download | portage-70993ee7fe1c3130c745c6c94c499b51c65f81d8.tar.gz portage-70993ee7fe1c3130c745c6c94c499b51c65f81d8.tar.bz2 portage-70993ee7fe1c3130c745c6c94c499b51c65f81d8.zip |
For bug #179206, improve efficiency by using a containment test instead of str.count inside update_dbentry. Thanks to Jason Lai <jason.lai@gmail.com>. (trunk r6559:6560)
svn path=/main/branches/2.1.2/; revision=6574
-rw-r--r-- | pym/portage_update.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/pym/portage_update.py b/pym/portage_update.py index 1a2a1d884..c3746d34d 100644 --- a/pym/portage_update.py +++ b/pym/portage_update.py @@ -16,7 +16,7 @@ ignored_dbentries = ("CONTENTS", "environment.bz2") def update_dbentry(update_cmd, mycontent): if update_cmd[0] == "move": old_value, new_value = update_cmd[1], update_cmd[2] - if mycontent.count(old_value): + if old_value in mycontent: old_value = re.escape(old_value); mycontent = re.sub(old_value+"(:|$|\\s)", new_value+"\\1", mycontent) def myreplace(matchobj): @@ -28,7 +28,7 @@ def update_dbentry(update_cmd, mycontent): elif update_cmd[0] == "slotmove" and get_operator(update_cmd[1]) is None: pkg, origslot, newslot = update_cmd[1:] old_value = "%s:%s" % (pkg, origslot) - if mycontent.count(old_value): + if old_value in mycontent: old_value = re.escape(old_value) new_value = "%s:%s" % (pkg, newslot) mycontent = re.sub(old_value+"($|\\s)", new_value+"\\1", mycontent) |