summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXavier Roche <xroche@users.noreply.github.com>2014-05-15 19:25:27 +0000
committerXavier Roche <xroche@users.noreply.github.com>2014-05-15 19:25:27 +0000
commitc457788a14940eed7a13ef056370b765c5f05e77 (patch)
tree255f00a2376a06c75833f1c51265cff79e4368f5
parent216005d33a220b0a638911bb8e8cb4a08d54584e (diff)
Compile-time checks.
-rw-r--r--src/htssafe.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/htssafe.h b/src/htssafe.h
index 6e4e84b..ad3513f 100644
--- a/src/htssafe.h
+++ b/src/htssafe.h
@@ -100,6 +100,17 @@ static HTS_UNUSED void abortf_(const char *exp, const char *file, int line) {
#endif
#define HTS_IS_NOT_CHAR_BUFFER(VAR) ( ! HTS_IS_CHAR_BUFFER(VAR) )
+/* Compile-time checks. */
+static HTS_UNUSED void htssafe_compile_time_check_() {
+ char array[32];
+ char *pointer = array;
+ char check_array[HTS_IS_CHAR_BUFFER(array) ? 1 : -1];
+ char check_pointer[HTS_IS_CHAR_BUFFER(pointer) ? -1 : 1];
+ (void) pointer;
+ (void) check_array;
+ (void) check_pointer;
+}
+
/**
* Append at most N characters from "B" to "A".
* If "A" is a char[] variable whose size is not sizeof(char*), then the size