aboutsummaryrefslogtreecommitdiffhomepage
path: root/sanity.h
diff options
context:
space:
mode:
Diffstat (limited to 'sanity.h')
-rw-r--r--sanity.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/sanity.h b/sanity.h
new file mode 100644
index 00000000..5cb22353
--- /dev/null
+++ b/sanity.h
@@ -0,0 +1,22 @@
+/** \file sanity.h
+ Prototypes for functions for performing sanity checks on the program state
+*/
+
+/**
+ Call this function to tell the program it is not in a sane state.
+*/
+void sanity_lose();
+
+/**
+ Perform sanity checks, return 1 if program is in a sane state 0 otherwise.
+*/
+int sanity_check();
+
+/**
+ Try and determine if ptr is a valid pointer. If not, loose sanity.
+
+ \param ptr The pointer to validate
+ \param err A description of what the pointer refers to, for use in error messages
+ \param null_ok Wheter the pointer is allowed to point to 0
+*/
+void validate_pointer( const void *ptr, const wchar_t *err, int null_ok );