Merge lp:~zorba-coders/zorba/bool-opt into lp:zorba

Proposed by Matthias Brantner
Status: Merged
Approved by: Markos Zaharioudakis
Approved revision: 10573
Merged at revision: 10573
Proposed branch: lp:~zorba-coders/zorba/bool-opt
Merge into: lp:zorba
Diff against target: 66 lines (+29/-3)
2 files modified
src/store/naive/simple_item_factory.cpp (+22/-3)
src/store/naive/simple_item_factory.h (+7/-0)
To merge this branch: bzr merge lp:~zorba-coders/zorba/bool-opt
Reviewer Review Type Date Requested Status
Markos Zaharioudakis Approve
Matthias Brantner Approve
Review via email: mp+84515@code.launchpad.net

Commit message

optimization: only have exactly two instances of boolean items in the simple store

Description of the change

optimization: only have exactly two instances of boolean items in the simple store

To post a comment you must log in.
Revision history for this message
Matthias Brantner (matthias-brantner) :
review: Approve
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue job bool-opt-2011-12-05T18-38-13.116Z is finished. The final status was:

All tests succeeded!

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Voting does not meet specified criteria. Required: Approve > 1, Disapprove < 1. Got: 1 Approve, 2 Pending.

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue job bool-opt-2011-12-05T19-42-06.548Z is finished. The final status was:

All tests succeeded!

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Voting does not meet specified criteria. Required: Approve > 1, Disapprove < 1. Got: 1 Approve, 2 Pending.

Revision history for this message
Markos Zaharioudakis (markos-za) :
review: Approve
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue job bool-opt-2011-12-05T20-11-08.647Z is finished. The final status was:

All tests succeeded!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/store/naive/simple_item_factory.cpp'
--- src/store/naive/simple_item_factory.cpp 2011-10-15 10:41:19 +0000
+++ src/store/naive/simple_item_factory.cpp 2011-12-05 18:30:31 +0000
@@ -43,15 +43,19 @@
43BasicItemFactory::BasicItemFactory(UriPool* uriPool, QNamePool* qnPool)43BasicItemFactory::BasicItemFactory(UriPool* uriPool, QNamePool* qnPool)
44 :44 :
45 theUriPool(uriPool),45 theUriPool(uriPool),
46 theQNamePool(qnPool)46 theQNamePool(qnPool),
47 theTrueItem(NULL),
48 theFalseItem(NULL)
47{49{
48}50}
4951
5052
51BasicItemFactory::~BasicItemFactory()53BasicItemFactory::~BasicItemFactory()
52{54{
55 theFalseItem = NULL;
56 theTrueItem = NULL;
53 theQNamePool = NULL;57 theQNamePool = NULL;
54 theUriPool = NULL;58 theUriPool = NULL;
55}59}
5660
5761
@@ -421,7 +425,22 @@
421425
422bool BasicItemFactory::createBoolean(store::Item_t& result, xs_boolean value)426bool BasicItemFactory::createBoolean(store::Item_t& result, xs_boolean value)
423{427{
424 result = new BooleanItem(value);428 if (value)
429 {
430 if (!theTrueItem)
431 {
432 theTrueItem = new BooleanItem(true);
433 }
434 result = theTrueItem;
435 }
436 else
437 {
438 if (!theFalseItem)
439 {
440 theFalseItem = new BooleanItem(false);
441 }
442 result = theFalseItem;
443 }
425 return true;444 return true;
426}445}
427446
428447
=== modified file 'src/store/naive/simple_item_factory.h'
--- src/store/naive/simple_item_factory.h 2011-10-15 10:41:19 +0000
+++ src/store/naive/simple_item_factory.h 2011-12-05 18:30:31 +0000
@@ -50,6 +50,13 @@
50 UriPool * theUriPool;50 UriPool * theUriPool;
51 QNamePool * theQNamePool;51 QNamePool * theQNamePool;
5252
53 // boolean items
54 // we don't need to create more than two, hence
55 // they are cached here. createBoolean always
56 // returns one of them
57 store::Item_t theTrueItem;
58 store::Item_t theFalseItem;
59
53public:60public:
54 BasicItemFactory(UriPool* uriPool, QNamePool* qnPool);61 BasicItemFactory(UriPool* uriPool, QNamePool* qnPool);
5562

Subscribers

People subscribed via source and target branches