mirror of https://gitee.com/bigwinds/arangodb
cppcheck
This commit is contained in:
parent
c38445aa64
commit
f5f61ea173
|
@ -107,9 +107,6 @@ bool ConditionFinder::before (ExecutionNode* en) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto const& varsValid = node->getVarsValid();
|
|
||||||
std::unordered_set<Variable const*> varsUsed;
|
|
||||||
|
|
||||||
std::unique_ptr<Condition> condition(new Condition(_plan->getAst()));
|
std::unique_ptr<Condition> condition(new Condition(_plan->getAst()));
|
||||||
|
|
||||||
for (auto& it : _variableDefinitions) {
|
for (auto& it : _variableDefinitions) {
|
||||||
|
@ -122,6 +119,8 @@ bool ConditionFinder::before (ExecutionNode* en) {
|
||||||
// normalize the condition
|
// normalize the condition
|
||||||
condition->normalize(_plan);
|
condition->normalize(_plan);
|
||||||
|
|
||||||
|
auto const& varsValid = node->getVarsValid();
|
||||||
|
|
||||||
// remove all invalid variables from the condition
|
// remove all invalid variables from the condition
|
||||||
if (condition->removeInvalidVariables(varsValid)) {
|
if (condition->removeInvalidVariables(varsValid)) {
|
||||||
// removing left a previously non-empty OR block empty...
|
// removing left a previously non-empty OR block empty...
|
||||||
|
|
|
@ -43,6 +43,10 @@ using Json = triagens::basics::Json;
|
||||||
EnumerateListBlock::EnumerateListBlock (ExecutionEngine* engine,
|
EnumerateListBlock::EnumerateListBlock (ExecutionEngine* engine,
|
||||||
EnumerateListNode const* en)
|
EnumerateListNode const* en)
|
||||||
: ExecutionBlock(engine, en),
|
: ExecutionBlock(engine, en),
|
||||||
|
_index(0),
|
||||||
|
_thisBlock(0),
|
||||||
|
_seen(0),
|
||||||
|
_collection(nullptr),
|
||||||
_inVarRegId(ExecutionNode::MaxRegisterId) {
|
_inVarRegId(ExecutionNode::MaxRegisterId) {
|
||||||
|
|
||||||
auto it = en->getRegisterPlan()->varInfo.find(en->_inVariable->id);
|
auto it = en->getRegisterPlan()->varInfo.find(en->_inVariable->id);
|
||||||
|
@ -75,9 +79,9 @@ int EnumerateListBlock::initializeCursor (AqlItemBlock* items, size_t pos) {
|
||||||
|
|
||||||
// handle local data (if any)
|
// handle local data (if any)
|
||||||
_index = 0; // index in _inVariable for next run
|
_index = 0; // index in _inVariable for next run
|
||||||
_thisblock = 0; // the current block in the _inVariable DOCVEC
|
_thisBlock = 0; // the current block in the _inVariable DOCVEC
|
||||||
_seen = 0; // the sum of the sizes of the blocks in the _inVariable
|
_seen = 0; // the sum of the sizes of the blocks in the _inVariable
|
||||||
// DOCVEC that preceed _thisblock
|
// DOCVEC that preceed _thisBlock
|
||||||
|
|
||||||
return TRI_ERROR_NO_ERROR;
|
return TRI_ERROR_NO_ERROR;
|
||||||
}
|
}
|
||||||
|
@ -130,14 +134,13 @@ AqlItemBlock* EnumerateListBlock::getSome (size_t, size_t atMost) {
|
||||||
|
|
||||||
case AqlValue::DOCVEC: {
|
case AqlValue::DOCVEC: {
|
||||||
if (_index == 0) { // this is a (maybe) new DOCVEC
|
if (_index == 0) { // this is a (maybe) new DOCVEC
|
||||||
_DOCVECsize = 0;
|
_docVecSize = 0;
|
||||||
// we require the total number of items
|
// we require the total number of items
|
||||||
|
|
||||||
for (size_t i = 0; i < inVarReg._vector->size(); i++) {
|
for (size_t i = 0; i < inVarReg._vector->size(); i++) {
|
||||||
_DOCVECsize += inVarReg._vector->at(i)->size();
|
_docVecSize += inVarReg._vector->at(i)->size();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sizeInVar = _DOCVECsize;
|
sizeInVar = _docVecSize;
|
||||||
if (sizeInVar > 0) {
|
if (sizeInVar > 0) {
|
||||||
_collection = inVarReg._vector->at(0)->getDocumentCollection(0);
|
_collection = inVarReg._vector->at(0)->getDocumentCollection(0);
|
||||||
}
|
}
|
||||||
|
@ -196,7 +199,7 @@ AqlItemBlock* EnumerateListBlock::getSome (size_t, size_t atMost) {
|
||||||
|
|
||||||
if (_index == sizeInVar) {
|
if (_index == sizeInVar) {
|
||||||
_index = 0;
|
_index = 0;
|
||||||
_thisblock = 0;
|
_thisBlock = 0;
|
||||||
_seen = 0;
|
_seen = 0;
|
||||||
// advance read position in the current block . . .
|
// advance read position in the current block . . .
|
||||||
if (++_pos == cur->size()) {
|
if (++_pos == cur->size()) {
|
||||||
|
@ -214,7 +217,6 @@ AqlItemBlock* EnumerateListBlock::getSome (size_t, size_t atMost) {
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t EnumerateListBlock::skipSome (size_t atLeast, size_t atMost) {
|
size_t EnumerateListBlock::skipSome (size_t atLeast, size_t atMost) {
|
||||||
|
|
||||||
if (_done) {
|
if (_done) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -255,13 +257,16 @@ size_t EnumerateListBlock::skipSome (size_t atLeast, size_t atMost) {
|
||||||
|
|
||||||
case AqlValue::DOCVEC: {
|
case AqlValue::DOCVEC: {
|
||||||
if (_index == 0) { // this is a (maybe) new DOCVEC
|
if (_index == 0) { // this is a (maybe) new DOCVEC
|
||||||
_DOCVECsize = 0;
|
_docVecSize = 0;
|
||||||
//we require the total number of items
|
// we require the total number of items
|
||||||
for (size_t i = 0; i < inVarReg._vector->size(); i++) {
|
for (size_t i = 0; i < inVarReg._vector->size(); i++) {
|
||||||
_DOCVECsize += inVarReg._vector->at(i)->size();
|
_docVecSize += inVarReg._vector->at(i)->size();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sizeInVar = _DOCVECsize;
|
sizeInVar = _docVecSize;
|
||||||
|
if (sizeInVar > 0) {
|
||||||
|
_collection = inVarReg._vector->at(0)->getDocumentCollection(0);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -280,7 +285,7 @@ size_t EnumerateListBlock::skipSome (size_t atLeast, size_t atMost) {
|
||||||
// eat the whole of the current inVariable and proceed . . .
|
// eat the whole of the current inVariable and proceed . . .
|
||||||
skipped += (sizeInVar - _index);
|
skipped += (sizeInVar - _index);
|
||||||
_index = 0;
|
_index = 0;
|
||||||
_thisblock = 0;
|
_thisBlock = 0;
|
||||||
_seen = 0;
|
_seen = 0;
|
||||||
delete cur;
|
delete cur;
|
||||||
_buffer.pop_front();
|
_buffer.pop_front();
|
||||||
|
@ -310,11 +315,11 @@ AqlValue EnumerateListBlock::getAqlValue (AqlValue const& inVarReg) {
|
||||||
return AqlValue(new Json(static_cast<double>(inVarReg._range->at(_index++))));
|
return AqlValue(new Json(static_cast<double>(inVarReg._range->at(_index++))));
|
||||||
}
|
}
|
||||||
case AqlValue::DOCVEC: { // incoming doc vec has a single column
|
case AqlValue::DOCVEC: { // incoming doc vec has a single column
|
||||||
AqlValue out = inVarReg._vector->at(_thisblock)->getValue(_index -
|
auto& block = inVarReg._vector->at(_thisBlock);
|
||||||
_seen, 0).clone();
|
AqlValue out = block->getValue(_index - _seen, 0).clone();
|
||||||
if (++_index == (inVarReg._vector->at(_thisblock)->size() + _seen)) {
|
if (++_index == block->size() + _seen) {
|
||||||
_seen += inVarReg._vector->at(_thisblock)->size();
|
_seen += block->size();
|
||||||
_thisblock++;
|
_thisBlock++;
|
||||||
}
|
}
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
|
@ -108,7 +108,7 @@ namespace triagens {
|
||||||
/// @brief current block in DOCVEC
|
/// @brief current block in DOCVEC
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
size_t _thisblock;
|
size_t _thisBlock;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
/// @brief number of elements in DOCVEC before the current block
|
/// @brief number of elements in DOCVEC before the current block
|
||||||
|
@ -120,7 +120,7 @@ namespace triagens {
|
||||||
/// @brief total number of elements in DOCVEC
|
/// @brief total number of elements in DOCVEC
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
size_t _DOCVECsize;
|
size_t _docVecSize;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
/// @brief document collection from DOCVEC
|
/// @brief document collection from DOCVEC
|
||||||
|
|
|
@ -223,8 +223,8 @@ static inline uint32_t TRI_64to32 (uint64_t x) {
|
||||||
#define TRI_FAKE_SPIN_LOCKS 1
|
#define TRI_FAKE_SPIN_LOCKS 1
|
||||||
|
|
||||||
#ifndef TRI_ASSERT
|
#ifndef TRI_ASSERT
|
||||||
#define TRI_ASSERT(expr) { if (! (expr)) TRI_PrintBacktrace(); assert(expr); }
|
#define TRI_ASSERT(expr) { if (! (expr)) { TRI_PrintBacktrace(); assert(expr); } }
|
||||||
#define TRI_ASSERT_EXPENSIVE(expr) { if (! (expr)) TRI_PrintBacktrace(); assert(expr); }
|
#define TRI_ASSERT_EXPENSIVE(expr) { if (! (expr)) { TRI_PrintBacktrace(); assert(expr); } }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -234,8 +234,9 @@ static inline uint32_t TRI_64to32 (uint64_t x) {
|
||||||
#undef TRI_FAKE_SPIN_LOCKS
|
#undef TRI_FAKE_SPIN_LOCKS
|
||||||
|
|
||||||
#ifndef TRI_ASSERT
|
#ifndef TRI_ASSERT
|
||||||
#define TRI_ASSERT(expr) (static_cast<void>(0))
|
#define TRI_ASSERT(expr) do { (void) 0; } while (0)
|
||||||
#define TRI_ASSERT_EXPENSIVE(expr) (static_cast<void>(0))
|
#define TRI_ASSERT_EXPENSIVE(expr) do { (void) 0; } while (0)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -173,7 +173,7 @@ namespace RandomHelper {
|
||||||
// ..............................................................................
|
// ..............................................................................
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
abort();
|
std::abort();
|
||||||
#else
|
#else
|
||||||
long flags = fcntl(fd, F_GETFL, 0);
|
long flags = fcntl(fd, F_GETFL, 0);
|
||||||
bool ok = (flags >= 0);
|
bool ok = (flags >= 0);
|
||||||
|
@ -190,16 +190,12 @@ namespace RandomHelper {
|
||||||
fillBuffer();
|
fillBuffer();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
~RandomDeviceCombined () {
|
~RandomDeviceCombined () {
|
||||||
if (fd >= 0) {
|
if (fd >= 0) {
|
||||||
TRI_CLOSE(fd);
|
TRI_CLOSE(fd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
uint32_t random () {
|
uint32_t random () {
|
||||||
if (pos >= N) {
|
if (pos >= N) {
|
||||||
fillBuffer();
|
fillBuffer();
|
||||||
|
|
Loading…
Reference in New Issue