diff options
Diffstat (limited to 'searchlib/src')
7 files changed, 73 insertions, 73 deletions
diff --git a/searchlib/src/vespa/searchlib/btree/btreebuilder.hpp b/searchlib/src/vespa/searchlib/btree/btreebuilder.hpp index 6c4abc85ab8..c21b31e2f4b 100644 --- a/searchlib/src/vespa/searchlib/btree/btreebuilder.hpp +++ b/searchlib/src/vespa/searchlib/btree/btreebuilder.hpp @@ -94,7 +94,7 @@ normalize() assert(_numInserts == 0); _allocator.holdNode(_leaf.ref, _leaf.data); _numLeafNodes--; - _leaf = LeafNodeTypeRefPair(NodeRef(), static_cast<LeafNodeType *>(NULL)); + _leaf = LeafNodeTypeRefPair(NodeRef(), static_cast<LeafNodeType *>(nullptr)); } if (AggrCalcT::hasAggregated()) { @@ -136,7 +136,7 @@ normalize() assert(level + 1 < _inodes.size()); iRef = leftInodes[level]; inode = _allocator.mapInternalRef(iRef); - assert(inode != NULL); + assert(inode != nullptr); assert(inode->validSlots() >= 1); child = inode->getLastChild(); } else { @@ -281,7 +281,7 @@ normalize() /* Check fanout on root node */ assert(level < _inodes.size()); InternalNodeType *inode = _inodes[level].data; - assert(inode != NULL); + assert(inode != nullptr); assert(inode->validSlots() >= 1); if (inode->validSlots() == 1) { /* Remove top level from proposed tree since fanout is 1 */ @@ -404,7 +404,7 @@ handover() ret = _leaf.ref; } - _leaf = LeafNodeTypeRefPair(NodeRef(), static_cast<LeafNodeType *>(NULL)); + _leaf = LeafNodeTypeRefPair(NodeRef(), static_cast<LeafNodeType *>(nullptr)); _inodes.clear(); _numInternalNodes = 0; @@ -434,17 +434,17 @@ clear() { if (!_inodes.empty()) { recursiveDelete(_inodes.back().ref); - _leaf = LeafNodeTypeRefPair(NodeRef(), static_cast<LeafNodeType *>(NULL)); + _leaf = LeafNodeTypeRefPair(NodeRef(), static_cast<LeafNodeType *>(nullptr)); _inodes.clear(); } if (NodeAllocatorType::isValidRef(_leaf.ref)) { - assert(_leaf.data != NULL); + assert(_leaf.data != nullptr); assert(_numLeafNodes == 1); _allocator.holdNode(_leaf.ref, _leaf.data); --_numLeafNodes; - _leaf = LeafNodeTypeRefPair(NodeRef(), static_cast<LeafNodeType *>(NULL)); + _leaf = LeafNodeTypeRefPair(NodeRef(), static_cast<LeafNodeType *>(nullptr)); } else { - assert(_leaf.data == NULL); + assert(_leaf.data == nullptr); } assert(_numLeafNodes == 0); assert(_numInternalNodes == 0); diff --git a/searchlib/src/vespa/searchlib/btree/btreeinserter.hpp b/searchlib/src/vespa/searchlib/btree/btreeinserter.hpp index fc2edaa70c7..97c40845e2c 100644 --- a/searchlib/src/vespa/searchlib/btree/btreeinserter.hpp +++ b/searchlib/src/vespa/searchlib/btree/btreeinserter.hpp @@ -33,7 +33,7 @@ insert(BTreeNode::Ref &root, uint32_t idx = itr.getLeafNodeIdx() + (inRange ? 0 : 1); LeafNodeType * lnode = itr.getLeafNode(); BTreeNode::Ref splitNodeRef; - const KeyT *splitLastKey = NULL; + const KeyT *splitLastKey = nullptr; bool inRightSplit = false; AggrT oldca(AggrCalcT::hasAggregated() ? lnode->getAggregated() : AggrT()); AggrT ca; @@ -89,7 +89,7 @@ insert(BTreeNode::Ref &root, ca = node->getAggregated(); } splitNodeRef = BTreeNode::Ref(); - splitLastKey = NULL; + splitLastKey = nullptr; } } else { if (AggrCalcT::hasAggregated()) { diff --git a/searchlib/src/vespa/searchlib/btree/btreeiterator.h b/searchlib/src/vespa/searchlib/btree/btreeiterator.h index 882682437ba..444a26f36d4 100644 --- a/searchlib/src/vespa/searchlib/btree/btreeiterator.h +++ b/searchlib/src/vespa/searchlib/btree/btreeiterator.h @@ -48,7 +48,7 @@ class NodeElement public: NodeElement() - : _node(NULL), + : _node(nullptr), _idx(0u) { } @@ -117,7 +117,7 @@ public: bool valid() const { - return _node != NULL; + return _node != nullptr; } void @@ -274,7 +274,7 @@ protected: */ BTreeIteratorBase & operator++() { - if (_leaf.getNode() == NULL) { + if (_leaf.getNode() == nullptr) { return *this; } _leaf.incIdx(); diff --git a/searchlib/src/vespa/searchlib/btree/btreeiterator.hpp b/searchlib/src/vespa/searchlib/btree/btreeiterator.hpp index 696343b9f3e..8d3955778ce 100644 --- a/searchlib/src/vespa/searchlib/btree/btreeiterator.hpp +++ b/searchlib/src/vespa/searchlib/btree/btreeiterator.hpp @@ -73,7 +73,7 @@ clearPath(uint32_t pathSize) uint32_t level = _pathSize; while (level > pathSize) { --level; - _path[level].setNodeAndIdx(NULL, 0u); + _path[level].setNodeAndIdx(nullptr, 0u); } _pathSize = pathSize; } @@ -106,7 +106,7 @@ void BTreeIteratorBase<KeyT, DataT, AggrT, INTERNAL_SLOTS, LEAF_SLOTS, PATH_SIZE>:: setupEnd() { - _leaf.setNodeAndIdx(NULL, 0u); + _leaf.setNodeAndIdx(nullptr, 0u); } @@ -117,8 +117,8 @@ BTreeIteratorBase<KeyT, DataT, AggrT, INTERNAL_SLOTS, LEAF_SLOTS, PATH_SIZE>:: setupEmpty() { clearPath(0u); - _leaf.setNodeAndIdx(NULL, 0u); - _leafRoot = NULL; + _leaf.setNodeAndIdx(nullptr, 0u); + _leafRoot = nullptr; } @@ -129,9 +129,9 @@ BTreeIteratorBase<KeyT, DataT, AggrT, INTERNAL_SLOTS, LEAF_SLOTS, PATH_SIZE>:: end() { if (_pathSize == 0) { - if (_leafRoot == NULL) + if (_leafRoot == nullptr) return; - _leaf.setNodeAndIdx(NULL, 0u); + _leaf.setNodeAndIdx(nullptr, 0u); return; } uint32_t level = _pathSize - 1; @@ -150,7 +150,7 @@ end() assert(childRef.valid()); } assert(_allocator->isLeafRef(childRef)); - _leaf.setNodeAndIdx(NULL, 0u); + _leaf.setNodeAndIdx(nullptr, 0u); } @@ -168,10 +168,10 @@ end(BTreeNode::Ref rootRef) clearPath(0u); const LeafNodeType *lnode = _allocator->mapLeafRef(rootRef); _leafRoot = lnode; - _leaf.setNodeAndIdx(NULL, 0u); + _leaf.setNodeAndIdx(nullptr, 0u); return; } - _leafRoot = NULL; + _leafRoot = nullptr; const InternalNodeType *inode = _allocator->mapInternalRef(rootRef); uint32_t idx = inode->validSlots(); uint32_t pidx = inode->getLevel(); @@ -190,7 +190,7 @@ end(BTreeNode::Ref rootRef) childRef = inode->getChild(idx - 1); assert(childRef.valid()); } - _leaf.setNodeAndIdx(NULL, 0u); + _leaf.setNodeAndIdx(nullptr, 0u); } @@ -218,7 +218,7 @@ findNextLeafNode() return; } } - _leaf.setNodeAndIdx(NULL, 0u); + _leaf.setNodeAndIdx(nullptr, 0u); } @@ -296,7 +296,7 @@ begin(BTreeNode::Ref rootRef) _leaf.setNodeAndIdx(lnode, 0u); return; } - _leafRoot = NULL; + _leafRoot = nullptr; const InternalNodeType *inode = _allocator->mapInternalRef(rootRef); uint32_t pidx = inode->getLevel(); clearPath(pidx); @@ -342,7 +342,7 @@ rbegin() _leaf.setNodeAndIdx(lnode, lnode->validSlots() - 1); } else { _leaf.setNodeAndIdx(_leafRoot, - (_leafRoot != NULL) ? + (_leafRoot != nullptr) ? _leafRoot->validSlots() - 1 : 0u); } @@ -359,7 +359,7 @@ getAggregated() const uint32_t pidx = _pathSize; if (pidx > 0u) { return _path[pidx - 1].getNode()->getAggregated(); - } else if (_leafRoot != NULL) { + } else if (_leafRoot != nullptr) { return _leafRoot->getAggregated(); } else { return LeafNodeType::getEmptyAggregated(); @@ -374,7 +374,7 @@ BTreeIteratorBase<KeyT, DataT, AggrT, INTERNAL_SLOTS, LEAF_SLOTS, PATH_SIZE>:: position(uint32_t levels) const { assert(_pathSize >= levels); - if (_leaf.getNode() == NULL) + if (_leaf.getNode() == nullptr) return size(); size_t res = _leaf.getIdx(); if (levels == 0) @@ -428,11 +428,11 @@ template <typename KeyT, typename DataT, typename AggrT, BTreeIteratorBase<KeyT, DataT, AggrT, INTERNAL_SLOTS, LEAF_SLOTS, PATH_SIZE>:: BTreeIteratorBase(BTreeNode::Ref root, const NodeAllocatorType &allocator) - : _leaf(NULL, 0u), + : _leaf(nullptr, 0u), _path(), _pathSize(0), _allocator(&allocator), - _leafRoot(NULL), + _leafRoot(nullptr), _compatLeafNode() { begin(root); @@ -447,11 +447,11 @@ BTreeIteratorBase(const KeyDataType *shortArray, uint32_t arraySize, const NodeAllocatorType &allocator, const AggrCalcT &aggrCalc) - : _leaf(NULL, 0u), + : _leaf(nullptr, 0u), _path(), _pathSize(0), _allocator(&allocator), - _leafRoot(NULL), + _leafRoot(nullptr), _compatLeafNode() { if(arraySize > 0) { @@ -472,11 +472,11 @@ template <typename KeyT, typename DataT, typename AggrT, uint32_t INTERNAL_SLOTS, uint32_t LEAF_SLOTS, uint32_t PATH_SIZE> BTreeIteratorBase<KeyT, DataT, AggrT, INTERNAL_SLOTS, LEAF_SLOTS, PATH_SIZE>:: BTreeIteratorBase() - : _leaf(NULL, 0u), + : _leaf(nullptr, 0u), _path(), _pathSize(0), - _allocator(NULL), - _leafRoot(NULL), + _allocator(nullptr), + _leafRoot(nullptr), _compatLeafNode() { } @@ -488,7 +488,7 @@ BTreeIteratorBase<KeyT, DataT, AggrT, INTERNAL_SLOTS, LEAF_SLOTS, PATH_SIZE> & BTreeIteratorBase<KeyT, DataT, AggrT, INTERNAL_SLOTS, LEAF_SLOTS, PATH_SIZE>:: operator--() { - if (_leaf.getNode() == NULL) { + if (_leaf.getNode() == nullptr) { rbegin(); return *this; } @@ -523,12 +523,12 @@ ssize_t BTreeIteratorBase<KeyT, DataT, AggrT, INTERNAL_SLOTS, LEAF_SLOTS, PATH_SIZE>:: operator-(const BTreeIteratorBase &rhs) const { - if (_leaf.getNode() == NULL) { - if (rhs._leaf.getNode() == NULL) + if (_leaf.getNode() == nullptr) { + if (rhs._leaf.getNode() == nullptr) return 0; // *this might not be normalized (i.e. default constructor) return rhs.size() - rhs.position(rhs._pathSize); - } else if (rhs._leaf.getNode() == NULL) { + } else if (rhs._leaf.getNode() == nullptr) { // rhs might not be normalized (i.e. default constructor) return position(_pathSize) - size(); } @@ -543,7 +543,7 @@ operator-(const BTreeIteratorBase &rhs) const } return position(pidx) - rhs.position(pidx); } else { - assert(_leaf.getNode() == NULL || rhs._leaf.getNode() == NULL || + assert(_leaf.getNode() == nullptr || rhs._leaf.getNode() == nullptr || _leaf.getNode() == rhs._leaf.getNode()); return position(0) - rhs.position(0); } @@ -581,11 +581,11 @@ BTreeConstIterator<KeyT, DataT, AggrT, CompareT, TraitsT>:: lower_bound(const KeyType & key, CompareT comp) { if (_pathSize == 0) { - if (_leafRoot == NULL) + if (_leafRoot == nullptr) return; uint32_t idx = _leafRoot->template lower_bound<CompareT>(key, comp); if (idx >= _leafRoot->validSlots()) { - _leaf.setNodeAndIdx(NULL, 0u); + _leaf.setNodeAndIdx(nullptr, 0u); } else { _leaf.setNodeAndIdx(_leafRoot, idx); } @@ -635,13 +635,13 @@ lower_bound(BTreeNode::Ref rootRef, const KeyType & key, CompareT comp) _leafRoot = lnode; uint32_t idx = lnode->template lower_bound<CompareT>(key, comp); if (idx >= lnode->validSlots()) { - _leaf.setNodeAndIdx(NULL, 0u); + _leaf.setNodeAndIdx(nullptr, 0u); } else { _leaf.setNodeAndIdx(lnode, idx); } return; } - _leafRoot = NULL; + _leafRoot = nullptr; const InternalNodeType *inode = _allocator->mapInternalRef(rootRef); uint32_t idx = inode->template lower_bound<CompareT>(key, comp); if (idx >= inode->validSlots()) { @@ -917,15 +917,15 @@ validate(BTreeNode::Ref rootRef, CompareT comp) bool frozen = false; if (!rootRef.valid()) { assert(_pathSize == 0u); - assert(_leafRoot == NULL); - assert(_leaf.getNode() == NULL); + assert(_leafRoot == nullptr); + assert(_leaf.getNode() == nullptr); return; } uint32_t level = _pathSize; BTreeNode::Ref nodeRef = rootRef; - const KeyT *parentKey = NULL; - const KeyT *leafKey = NULL; - if (_leaf.getNode() != NULL) { + const KeyT *parentKey = nullptr; + const KeyT *leafKey = nullptr; + if (_leaf.getNode() != nullptr) { leafKey = &_leaf.getNode()->getKey(_leaf.getIdx()); } while (level > 0) { @@ -934,7 +934,7 @@ validate(BTreeNode::Ref rootRef, CompareT comp) const PathElement &pe = _path[level]; assert(pe.getNode() == _allocator->mapInternalRef(nodeRef)); uint32_t idx = pe.getIdx(); - if (leafKey == NULL) { + if (leafKey == nullptr) { assert(idx == 0 || idx == pe.getNode()->validSlots()); if (idx == pe.getNode()->validSlots()) @@ -944,13 +944,13 @@ validate(BTreeNode::Ref rootRef, CompareT comp) assert(!frozen || pe.getNode()->getFrozen()); (void) frozen; frozen = pe.getNode()->getFrozen(); - if (parentKey != NULL) { + if (parentKey != nullptr) { assert(idx + 1 == pe.getNode()->validSlots() || comp(pe.getNode()->getKey(idx), *parentKey)); assert(!comp(*parentKey, pe.getNode()->getKey(idx))); (void) comp; } - if (leafKey != NULL) { + if (leafKey != nullptr) { assert(idx == 0 || comp(pe.getNode()->getKey(idx - 1), *leafKey)); assert(idx + 1 == pe.getNode()->validSlots() || @@ -965,11 +965,11 @@ validate(BTreeNode::Ref rootRef, CompareT comp) assert(_allocator->isLeafRef(nodeRef)); if (_pathSize == 0) { assert(_leafRoot == _allocator->mapLeafRef(nodeRef)); - assert(_leaf.getNode() == NULL || _leaf.getNode() == _leafRoot); + assert(_leaf.getNode() == nullptr || _leaf.getNode() == _leafRoot); } else { - assert(_leafRoot == NULL); + assert(_leafRoot == nullptr); assert(_leaf.getNode() == _allocator->mapLeafRef(nodeRef) || - _leaf.getNode() == NULL); + _leaf.getNode() == nullptr); } } @@ -982,11 +982,11 @@ moveFirstLeafNode(BTreeNode::Ref rootRef) { if (!NodeAllocatorType::isValidRef(rootRef)) { assert(_pathSize == 0); - assert(_leaf.getNode() == NULL); + assert(_leaf.getNode() == nullptr); return rootRef; } - assert(_leaf.getNode() != NULL); + assert(_leaf.getNode() != nullptr); NodeAllocatorType &allocator = getAllocator(); if (_pathSize == 0) { @@ -1168,7 +1168,7 @@ BTreeNode::Ref BTreeIterator<KeyT, DataT, AggrT, CompareT, TraitsT>:: thaw(BTreeNode::Ref rootRef) { - assert(_leaf.getNode() != NULL && _compatLeafNode.get() == NULL); + assert(_leaf.getNode() != nullptr && _compatLeafNode.get() == nullptr); if (!_leaf.getNode()->getFrozen()) return rootRef; NodeAllocatorType &allocator = getAllocator(); @@ -1182,7 +1182,7 @@ thaw(BTreeNode::Ref rootRef) _leafRoot = thawedLeaf.data; return thawedLeaf.ref; } - assert(_leafRoot == NULL); + assert(_leafRoot == nullptr); assert(_path[_pathSize - 1].getNode() == allocator.mapInternalRef(rootRef)); BTreeNode::Ref childRef(_path[0].getNode()->getChild(_path[0].getIdx())); @@ -1226,7 +1226,7 @@ insertFirst(const KeyType &key, const DataType &data, const AggrCalcT &aggrCalc) { assert(_pathSize == 0); - assert(_leafRoot == NULL); + assert(_leafRoot == nullptr); NodeAllocatorType &allocator = getAllocator(); LeafNodeTypeRefPair lnode = allocator.allocLeafNode(); lnode.data->insert(0, key, data); @@ -1288,7 +1288,7 @@ addLevel(BTreeNode::Ref rootRef, BTreeNode::Ref splitNodeRef, } _path[_pathSize].setNodeAndIdx(inode, inRightSplit ? 1u : 0u); if (_pathSize == 0) { - _leafRoot = NULL; + _leafRoot = nullptr; } ++_pathSize; return inodePair.ref; @@ -1305,7 +1305,7 @@ removeLevel(BTreeNode::Ref rootRef, InternalNodeType *rootNode) NodeAllocatorType &allocator(getAllocator()); allocator.holdNode(rootRef, rootNode); --_pathSize; - _path[_pathSize].setNodeAndIdx(NULL, 0u); + _path[_pathSize].setNodeAndIdx(nullptr, 0u); if (_pathSize == 0) { _leafRoot = _leaf.getNode(); } @@ -1321,8 +1321,8 @@ removeLast(BTreeNode::Ref rootRef) { NodeAllocatorType &allocator(getAllocator()); allocator.holdNode(rootRef, getLeafNode()); - _leafRoot = NULL; - _leaf.setNode(NULL); + _leafRoot = nullptr; + _leaf.setNode(nullptr); } diff --git a/searchlib/src/vespa/searchlib/btree/btreenodeallocator.hpp b/searchlib/src/vespa/searchlib/btree/btreenodeallocator.hpp index 2ff6acad0b6..4ea2035c73a 100644 --- a/searchlib/src/vespa/searchlib/btree/btreenodeallocator.hpp +++ b/searchlib/src/vespa/searchlib/btree/btreenodeallocator.hpp @@ -406,7 +406,7 @@ vespalib::string BTreeNodeAllocator<KeyT, DataT, AggrT, INTERNAL_SLOTS, LEAF_SLOTS>:: toString(const BTreeNode * node) const { - if (node == NULL) { + if (node == nullptr) { return "NULL"; } vespalib::asciistream ss; diff --git a/searchlib/src/vespa/searchlib/btree/btreeremover.hpp b/searchlib/src/vespa/searchlib/btree/btreeremover.hpp index c779e745957..c304ea13016 100644 --- a/searchlib/src/vespa/searchlib/btree/btreeremover.hpp +++ b/searchlib/src/vespa/searchlib/btree/btreeremover.hpp @@ -25,9 +25,9 @@ steal(InternalNodeType *pNode, uint32_t level) { BTreeNode::Ref leftVictimRef = BTreeNode::Ref(); - NodeType * leftVictim = NULL; + NodeType * leftVictim = nullptr; BTreeNode::Ref rightVictimRef = BTreeNode::Ref(); - NodeType * rightVictim = NULL; + NodeType * rightVictim = nullptr; if (idx > 0) { leftVictimRef = pNode->getChild(idx - 1); leftVictim = allocator.template mapRef<NodeType>(leftVictimRef); @@ -36,7 +36,7 @@ steal(InternalNodeType *pNode, rightVictimRef = pNode->getChild(idx + 1); rightVictim = allocator.template mapRef<NodeType>(rightVictimRef); } - if (leftVictim != NULL && + if (leftVictim != nullptr && leftVictim->validSlots() + sNode->validSlots() <= NodeType::maxSlots()) { @@ -46,7 +46,7 @@ steal(InternalNodeType *pNode, pNode->remove(idx - 1); allocator.holdNode(leftVictimRef, leftVictim); itr.adjustSteal(level, true, stolen); - } else if (rightVictim != NULL && + } else if (rightVictim != nullptr && rightVictim->validSlots() + sNode->validSlots() <= NodeType::maxSlots()) { @@ -54,8 +54,8 @@ steal(InternalNodeType *pNode, pNode->update(idx, sNode->getLastKey(), sNodeRef); pNode->remove(idx + 1); allocator.holdNode(rightVictimRef, rightVictim); - } else if (leftVictim != NULL && - (rightVictim == NULL || + } else if (leftVictim != nullptr && + (rightVictim == nullptr || leftVictim->validSlots() > rightVictim->validSlots())) { if (leftVictim->getFrozen()) { @@ -73,7 +73,7 @@ steal(InternalNodeType *pNode, Aggregator::recalc(*leftVictim, allocator, aggrCalc); } itr.adjustSteal(level, false, stolen); - } else if (rightVictim != NULL) { + } else if (rightVictim != nullptr) { if (rightVictim->getFrozen()) { NodeTypeRefPair thawed = allocator.thawNode(rightVictimRef, rightVictim); diff --git a/searchlib/src/vespa/searchlib/btree/btreestore.hpp b/searchlib/src/vespa/searchlib/btree/btreestore.hpp index 52274e404df..d734aa1340f 100644 --- a/searchlib/src/vespa/searchlib/btree/btreestore.hpp +++ b/searchlib/src/vespa/searchlib/btree/btreestore.hpp @@ -243,7 +243,7 @@ insert(EntryRef &ref, } KeyDataType addition(key, data); if (retVal) { - apply(ref, &addition, &addition+1, NULL, NULL, comp); + apply(ref, &addition, &addition+1, nullptr, nullptr, comp); } return retVal; #else |