From 544d9a24d05465a00b05d52c428041abb4e0739c Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Sun, 20 May 2007 19:59:53 +0000 Subject: For bug #179206, improve efficiency by using a containment test instead of str.count inside update_dbentry. Thanks to Jason Lai . svn path=/main/trunk/; revision=6560 --- pym/portage/update.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'pym') diff --git a/pym/portage/update.py b/pym/portage/update.py index 472eebe96..34c91224b 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) -- cgit v1.2.3-1-g7c22