From 904c1b4d699aeb1ce170f0cd996a01d2d06812e3 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Fri, 10 Sep 2021 20:11:46 -0400 Subject: Add nullability annotations This allows clang to issue warnings at compile time when null is passed to a non-null parameter. For public entry points, also add assertions to catch such issues when the compiler does not support this. --- include/zix/digest.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'include/zix/digest.h') diff --git a/include/zix/digest.h b/include/zix/digest.h index 139a0bd..6462717 100644 --- a/include/zix/digest.h +++ b/include/zix/digest.h @@ -45,7 +45,7 @@ extern "C" { */ ZIX_PURE_API uint32_t -zix_digest32(uint32_t seed, const void* buf, size_t len); +zix_digest32(uint32_t seed, const void* ZIX_NONNULL buf, size_t len); /** Return a 32-bit hash of an aligned buffer. @@ -55,7 +55,7 @@ zix_digest32(uint32_t seed, const void* buf, size_t len); */ ZIX_PURE_API uint32_t -zix_digest32_aligned(uint32_t seed, const void* buf, size_t len); +zix_digest32_aligned(uint32_t seed, const void* ZIX_NONNULL buf, size_t len); /** Return a 64-bit hash of a buffer. @@ -64,7 +64,7 @@ zix_digest32_aligned(uint32_t seed, const void* buf, size_t len); */ ZIX_PURE_API uint64_t -zix_digest64(uint64_t seed, const void* buf, size_t len); +zix_digest64(uint64_t seed, const void* ZIX_NONNULL buf, size_t len); /** Return a 64-bit hash of an aligned buffer. @@ -74,7 +74,7 @@ zix_digest64(uint64_t seed, const void* buf, size_t len); */ ZIX_PURE_API uint64_t -zix_digest64_aligned(uint64_t seed, const void* buf, size_t len); +zix_digest64_aligned(uint64_t seed, const void* ZIX_NONNULL buf, size_t len); /** Return a pointer-sized hash of a buffer. @@ -86,7 +86,7 @@ zix_digest64_aligned(uint64_t seed, const void* buf, size_t len); */ ZIX_PURE_API size_t -zix_digest(size_t seed, const void* buf, size_t len); +zix_digest(size_t seed, const void* ZIX_NONNULL buf, size_t len); /** Return a pointer-sized hash of an aligned buffer. @@ -100,7 +100,7 @@ zix_digest(size_t seed, const void* buf, size_t len); */ ZIX_PURE_API size_t -zix_digest_aligned(size_t seed, const void* buf, size_t len); +zix_digest_aligned(size_t seed, const void* ZIX_NONNULL buf, size_t len); #ifdef __cplusplus } /* extern "C" */ -- cgit v1.2.1