mirror of
https://github.com/MariaDB/server.git
synced 2026-01-06 05:22:24 +03:00
merged
This commit is contained in:
@@ -192,6 +192,54 @@ public:
|
||||
friend class error_list;
|
||||
friend class error_list_iterator;
|
||||
|
||||
#ifdef LIST_EXTRA_DEBUG
|
||||
/*
|
||||
Check list invariants and print results into trace. Invariants are:
|
||||
- (*last) points to end_of_list
|
||||
- There are no NULLs in the list.
|
||||
- base_list::elements is the number of elements in the list.
|
||||
|
||||
SYNOPSIS
|
||||
check_list()
|
||||
name Name to print to trace file
|
||||
|
||||
RETURN
|
||||
1 The list is Ok.
|
||||
0 List invariants are not met.
|
||||
*/
|
||||
|
||||
bool check_list(const char *name)
|
||||
{
|
||||
base_list *list= this;
|
||||
list_node *node= first;
|
||||
uint cnt= 0;
|
||||
|
||||
while (node->next != &end_of_list)
|
||||
{
|
||||
if (!node->info)
|
||||
{
|
||||
DBUG_PRINT("list_invariants",("%s: error: NULL element in the list",
|
||||
name));
|
||||
return FALSE;
|
||||
}
|
||||
node= node->next;
|
||||
cnt++;
|
||||
}
|
||||
if (last != &(node->next))
|
||||
{
|
||||
DBUG_PRINT("list_invariants", ("%s: error: wrong last pointer", name));
|
||||
return FALSE;
|
||||
}
|
||||
if (cnt+1 != elements)
|
||||
{
|
||||
DBUG_PRINT("list_invariants", ("%s: error: wrong element count", name));
|
||||
return FALSE;
|
||||
}
|
||||
DBUG_PRINT("list_invariants", ("%s: list is ok", name));
|
||||
return TRUE;
|
||||
}
|
||||
#endif // LIST_EXTRA_DEBUG
|
||||
|
||||
protected:
|
||||
void after(void *info,list_node *node)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user