[bitbake-devel,02/16] data: Be explicit in data_db check

Submitted by Richard Purdie on Sept. 16, 2013, 9:53 p.m. | Patch ID: 58187


Message ID 1379368413-9808-2-git-send-email-richard.purdie@linuxfoundation.org
State Accepted
Commit 43a245bde318545ea75ca4ce7894395c1cf9b32a
Headers show

Commit Message

Richard Purdie Sept. 16, 2013, 9:53 p.m.
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 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/lib/bb/data.py b/lib/bb/data.py
index 8c9cb0f..e6d5232 100644
--- a/lib/bb/data.py
+++ b/lib/bb/data.py
@@ -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()
         return _dict_type()