* lib/calloc.c: Include stdckdint.h, xalloc-oversized.h.
(rpl_calloc): Use ckd_mul instead of xalloc_oversized.
* modules/calloc-gnu, modules/calloc-posix:
(Depends-on): Depend on stdckdint, not xalloc-oversized.
2024-11-04 Paul Eggert <eggert@cs.ucla.edu>
+ calloc: depend on stdckdint not xalloc-oversized
+ * lib/calloc.c: Include stdckdint.h, xalloc-oversized.h.
+ (rpl_calloc): Use ckd_mul instead of xalloc_oversized.
+ * modules/calloc-gnu, modules/calloc-posix:
+ (Depends-on): Depend on stdckdint, not xalloc-oversized.
+
malloc etc. tests: use volatile more consistently
Typically it’s ineffective to use ‘void *volatile p’
when testing malloc and similar functions, as the compiler
#include <stdlib.h>
#include <errno.h>
-
-#include "xalloc-oversized.h"
+#include <stdckdint.h>
/* Call the system's calloc below. */
#undef calloc
if (n == 0 || s == 0)
n = s = 1;
- if (xalloc_oversized (n, s))
+ ptrdiff_t signed_n;
+ if (ckd_mul (&signed_n, n, s))
{
errno = ENOMEM;
return NULL;
Depends-on:
calloc-posix
extensions-aix
-xalloc-oversized [test $REPLACE_CALLOC_FOR_CALLOC_GNU = 1]
+stdckdint [test $REPLACE_CALLOC_FOR_CALLOC_GNU = 1]
configure.ac:
gl_FUNC_CALLOC_GNU
m4/malloc.m4
Depends-on:
+stdckdint [test $REPLACE_CALLOC_FOR_CALLOC_POSIX = 1]
stdlib
-xalloc-oversized [test $REPLACE_CALLOC_FOR_CALLOC_POSIX = 1]
configure.ac:
gl_FUNC_CALLOC_POSIX