static inline int rdataset_dematerialized_size(const uint8_t *data, uint16_t *rdataset_count)
{
uint16_t count;
- kr_require(sizeof(count) == KR_CACHE_RR_COUNT_SIZE);
+ static_assert(sizeof(count) == KR_CACHE_RR_COUNT_SIZE,
+ "Unexpected KR_CACHE_RR_COUNT_SIZE.");
memcpy(&count, data, sizeof(count));
const uint8_t *rdata = data + sizeof(count);
if (rdataset_count) // memcpy is safe for unaligned case (on non-x86)
#define KR_PRINTF(n)
#endif
-#ifndef uint /* Redefining typedef is a C11 feature. */
typedef unsigned int uint;
-#define uint uint
-#endif
/*
* Error codes.
}
#define kr_strerror(x) strerror(abs(x))
+/* We require C11 but want to avoid including the standard assertion header
+ * so we alias it ourselves. */
+#define static_assert _Static_assert
+
/*
* Connection limits.
* @cond internal
knot_rrtype_to_string((rrtype), rrtype_str, sizeof(rrtype_str)); \
rrtype_str[sizeof(rrtype_str) - 1] = 0;
-/* C11 compatibility, but without any implementation so far. */
-#ifndef static_assert
-#define static_assert(cond, msg)
-#endif
-
// Use this for alocations with mm.
// Use mm_alloc for alocations into mempool