]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
data: Be explicit in data_db check
authorRichard Purdie <richard.purdie@linuxfoundation.org>
Mon, 16 Sep 2013 07:13:38 +0000 (07:13 +0000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Tue, 17 Sep 2013 13:09:37 +0000 (14:09 +0100)
The if statement current causes the size of parent to be calcuated which
is like a len() operation on a datastore. Since we're only interested
whether the value is none, checking explictly for this gives a
small performance gain.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
lib/bb/data.py

index 8c9cb0f025ca2e3869a28e5ba26869923d92f7a6..e6d523210c85c4bd594b7a01f32cb2780d963042 100644 (file)
@@ -59,7 +59,7 @@ def init():
 def init_db(parent = None):
     """Return a new object representing the Bitbake data,
     optionally based on an existing object"""
-    if parent:
+    if parent is not None:
         return parent.createCopy()
     else:
         return _dict_type()