diff options
author | 2015-07-26 10:20:13 +0800 | |
---|---|---|
committer | 2015-07-26 10:20:13 +0800 | |
commit | 3929e9de0e69666b37df87347d5ce15663e81347 (patch) | |
tree | b2701c439c0260840ce1c68beaebf7de1178cc53 /src/sanity.h | |
parent | 793e1afa084982dac92c4fe19e50c25e326a79c2 (diff) | |
parent | f4d1657c22c81a7720a91026f915b80d2d6aa6e8 (diff) |
Merge branch 'master' into iwyu
Diffstat (limited to 'src/sanity.h')
-rw-r--r-- | src/sanity.h | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/sanity.h b/src/sanity.h new file mode 100644 index 00000000..7480c403 --- /dev/null +++ b/src/sanity.h @@ -0,0 +1,27 @@ +/** \file sanity.h + Prototypes for functions for performing sanity checks on the program state +*/ + +#ifndef FISH_SANITY_H +#define FISH_SANITY_H + +/** + 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); + +#endif |