GDTR list integrity check (debug builds only)

This commit is contained in:
Pavel Kirienko 2014-04-20 21:33:51 +04:00
parent b7b53630d1
commit 5cd0aff0d3

View File

@ -95,9 +95,20 @@ GlobalDataTypeRegistry::RegistResult GlobalDataTypeRegistry::registImpl(Entry* d
p = p->getNextListNode();
}
}
#if UAVCAN_DEBUG
const unsigned len_before = list->getLength();
#endif
list->insertBefore(dtd, EntryInsertionComparator(dtd));
#if UAVCAN_DEBUG
{ // List integrity check
const unsigned len_after = list->getLength();
if (len_before >= len_after)
{
assert(0);
std::abort();
}
}
{ // Order check
Entry* p = list->get();
int id = -1;