diff --git a/configure.ac b/configure.ac index f70579d..c1e469f 100644 --- a/configure.ac +++ b/configure.ac @@ -40,22 +40,6 @@ AC_PROG_CPP AC_PROG_INSTALL AC_PROG_MAKE_SET -# -- Checks for platform-specific features -- - -AC_MSG_CHECKING([if null pointers have an all-zero representation]) -AC_RUN_IFELSE([ - AC_LANG_PROGRAM([[#include ]], - [[void *ptr = NULL; char buf[sizeof(ptr)] = { 0 }; - if (0 != memcmp(buf, &ptr, sizeof(ptr))) return 1;]]) -], [ - AC_MSG_RESULT([yes]) -], [ - AC_MSG_RESULT([no]) - AC_MSG_ERROR(m4_normalize([ - Null pointers do not have an all-zero representation on this platform. - ])) -]) - # -- Checks for features -- BOOKMARKFS_FEAT([bookmarkfs-util], [no], [the BookmarkFS utility library]) diff --git a/src/hashmap.c b/src/hashmap.c index a1cd827..6a1106c 100644 --- a/src/hashmap.c +++ b/src/hashmap.c @@ -300,17 +300,19 @@ hashmap_create ( hashmap_hash_func *entry_hash ) { size_t buckets_len = BUCKET_CNT(EXP_MIN); - // XXX: Null pointers have an implementation-defined value - // per ISO C standard, and should not be zero-initialized with calloc(). - // However, it is guaranteed to be zero on most, if not all, - // modern ABI standards that we know of. + // XXX: According to the ISO C standard, null pointers have an + // implementation-defined value, and should not be zero-initialized + // with calloc() or memset(). // - // Nevertheless, we add a build-time check just in case (see configure.ac). + // However, it is guaranteed to be all-bits-zero on most, + // if not all, modern ABI standards that we know of. + // POSIX also has such requirements since POSIX.1-2024. // // See: // - // - // - + // - struct bucket *buckets = xcalloc(buckets_len, sizeof(struct bucket)); struct hashmap *h = xmalloc(sizeof(*h));