summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb
diff options
context:
space:
mode:
authorAlexandru DAMIAN <alexandru.damian@intel.com>2013-09-16 07:40:20 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-09-17 14:11:04 +0100
commit0902850e979511b27a4c452b39b9557d57cbb039 (patch)
tree5a4763418e58b4a0805ec234cf55dc83fd554cea /bitbake/lib/bb
parent66c9c01b2b14a973d6b97755a343760710312be9 (diff)
downloadpoky-0902850e979511b27a4c452b39b9557d57cbb039.tar.gz
bitbake: data_smart: Add explict None checks
Simple if xxx checks end up calling len(xxx). We're interested in the specific case of None which means we can break out the iterator much earlier after the first item. This adds in the specific tests for None in what is a hot path in the data store code which gives small performance gains. (Bitbake rev: a4d81e44a7cd3dafb0bf12f7cac5ff511db18e60) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb')
-rw-r--r--bitbake/lib/bb/data_smart.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/bitbake/lib/bb/data_smart.py b/bitbake/lib/bb/data_smart.py
index 1bb186e100..970e404b17 100644
--- a/bitbake/lib/bb/data_smart.py
+++ b/bitbake/lib/bb/data_smart.py
@@ -588,7 +588,7 @@ class DataSmart(MutableMapping):
588 def getVarFlag(self, var, flag, expand=False, noweakdefault=False): 588 def getVarFlag(self, var, flag, expand=False, noweakdefault=False):
589 local_var = self._findVar(var) 589 local_var = self._findVar(var)
590 value = None 590 value = None
591 if local_var: 591 if local_var is not None:
592 if flag in local_var: 592 if flag in local_var:
593 value = copy.copy(local_var[flag]) 593 value = copy.copy(local_var[flag])
594 elif flag == "_content" and "defaultval" in local_var and not noweakdefault: 594 elif flag == "_content" and "defaultval" in local_var and not noweakdefault:
@@ -599,7 +599,7 @@ class DataSmart(MutableMapping):
599 if flag == "_content": 599 if flag == "_content":
600 cachename = var 600 cachename = var
601 value = self.expand(value, cachename) 601 value = self.expand(value, cachename)
602 if value and flag == "_content" and local_var and "_removeactive" in local_var: 602 if value is not None and flag == "_content" and local_var is not None and "_removeactive" in local_var:
603 filtered = filter(lambda v: v not in local_var["_removeactive"], 603 filtered = filter(lambda v: v not in local_var["_removeactive"],
604 value.split(" ")) 604 value.split(" "))
605 value = " ".join(filtered) 605 value = " ".join(filtered)