From 70993ee7fe1c3130c745c6c94c499b51c65f81d8 Mon Sep 17 00:00:00 2001
From: Zac Medico <zmedico@gentoo.org>
Date: Tue, 22 May 2007 13:15:38 +0000
Subject: [PATCH] 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
---
 pym/portage_update.py | 4 ++--
 1 file 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)
-- 
2.26.2