summaryrefslogtreecommitdiff
path: root/sql/sql_list.h
diff options
context:
space:
mode:
authorserg@serg.mylan <>2005-05-19 15:20:10 +0200
committerserg@serg.mylan <>2005-05-19 15:20:10 +0200
commit23a59c9857ad7f55b5eb53672298d31c9a681cfd (patch)
treeda2c7aa4f986716b622d061f3949dc2c92a1df20 /sql/sql_list.h
parentf30f95183be08bcbf449fe7f632d84c21ac8dad6 (diff)
parent1bb2a929fb6707316f894cffbb8956fbe3a77ea3 (diff)
downloadmariadb-git-23a59c9857ad7f55b5eb53672298d31c9a681cfd.tar.gz
merged
Diffstat (limited to 'sql/sql_list.h')
-rw-r--r--sql/sql_list.h48
1 files changed, 48 insertions, 0 deletions
diff --git a/sql/sql_list.h b/sql/sql_list.h
index ac0f7f7012a..09c01931c38 100644
--- a/sql/sql_list.h
+++ b/sql/sql_list.h
@@ -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)
{