summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrew Opalach <andrew@akon.city> 2024-10-06 13:32:00 -0400
committerAndrew Opalach <andrew@akon.city> 2024-10-06 13:32:00 -0400
commite6710f5ad898b54a4ae74d57858ba1287f0ef8bf (patch)
tree8c6903227735f59e8a821cca8b4aa4e0a1a6816b /src
parentc682feffb0a6cde943687587721f2603b3846ceb (diff)
downloadlibalabaster-e6710f5ad898b54a4ae74d57858ba1287f0ef8bf.tar.gz
libalabaster-e6710f5ad898b54a4ae74d57858ba1287f0ef8bf.tar.bz2
libalabaster-e6710f5ad898b54a4ae74d57858ba1287f0ef8bf.zip
lib: Cleanup types and assert sizeof(int) = 4
Signed-off-by: Andrew Opalach <andrew@akon.city>
Diffstat (limited to 'src')
-rw-r--r--src/lib.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/lib.c b/src/lib.c
index 063da23..0033463 100644
--- a/src/lib.c
+++ b/src/lib.c
@@ -1,5 +1,12 @@
#include "../include/al/lib.h"
+// https://forum.vcfed.org/index.php?threads/c-item-size-check-at-compile-time.1244920/
+#define AL_ASSERT_TYPE_SIZE(type, size) \
+ typedef char type##__size_test[( !!(sizeof(type) == size) )*2-1]
+
+AL_ASSERT_TYPE_SIZE(int, 4);
+AL_ASSERT_TYPE_SIZE(unsigned, 4);
+
#if AL_USE_STDLIB
static void *(*_al_malloc)(size_t) = malloc;
static void *(*_al_calloc)(size_t, size_t) = calloc;