2023-05-01 Paul Eggert <eggert@cs.ucla.edu>
+ dynarray: prefer C23 style overflow checking
+ * lib/malloc/dynarray_emplace_enlarge.c, lib/malloc/dynarray_resize.c:
+ Include stdckdint.h, not intprops.h.
+ * lib/malloc/dynarray_emplace_enlarge.c:
+ (__libc_dynarray_emplace_enlarge):
+ * lib/malloc/dynarray_resize.c (__libc_dynarray_resize):
+ Prefer stdckdint.h to intprops.h macros.
+ * modules/glibc-internal/dynarray (Depends-on):
+ Depend on stdckdint, not intprops.
+
mktime: prefer C23 style overflow checking
Prefer stdckdint.h macros to intprops.h macros where either will do,
as this is the C23 standard. Also, it ports around a pcc bug.
#include <dynarray.h>
#include <errno.h>
-#include <intprops.h>
+#include <stdckdint.h>
#include <stdlib.h>
#include <string.h>
}
size_t new_size;
- if (INT_MULTIPLY_WRAPV (new_allocated, element_size, &new_size))
+ if (ckd_mul (&new_size, new_allocated, element_size))
return false;
void *new_array;
if (list->array == scratch)
#include <dynarray.h>
#include <errno.h>
-#include <intprops.h>
+#include <stdckdint.h>
#include <stdlib.h>
#include <string.h>
over-allocation here. */
size_t new_size_bytes;
- if (INT_MULTIPLY_WRAPV (size, element_size, &new_size_bytes))
+ if (ckd_mul (&new_size_bytes, size, element_size))
{
/* Overflow. */
__set_errno (ENOMEM);