]> Savannah Git Hosting - gnulib.git/commitdiff
malloc-gnu: depend on stdckdint not xalloc-oversized
authorPaul Eggert <eggert@cs.ucla.edu>
Sun, 3 Nov 2024 20:19:33 +0000 (12:19 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Tue, 5 Nov 2024 05:40:17 +0000 (21:40 -0800)
* lib/malloc.c: Include stdckdint.h, xalloc-oversized.h.
(rpl_malloc): Use ckd_mul instead of xalloc_oversized.
* modules/malloc-gnu, modules/malloc-posix:
(Depends-on): Depend on stdckdint, not xalloc-oversized.

ChangeLog
lib/malloc.c
modules/malloc-gnu
modules/malloc-posix

index af6fce7f00d5ca9d24089467674aab1229c06e4c..d9c9cad52c2ebcb73ae3dc160fdc001ce9c5cd7d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2024-11-04  Paul Eggert  <eggert@cs.ucla.edu>
 
+       malloc-gnu: depend on stdckdint not xalloc-oversized
+       * lib/malloc.c: Include stdckdint.h, xalloc-oversized.h.
+       (rpl_malloc): Use ckd_mul instead of xalloc_oversized.
+       * modules/malloc-gnu, modules/malloc-posix:
+       (Depends-on): Depend on stdckdint, not xalloc-oversized.
+
        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.
index 2a7867a1d1ffa286ab32aab1364d4c48ea04924a..90018863ea6deaa57a4eb6735522257e308b71e8 100644 (file)
@@ -23,8 +23,7 @@
 #include <stdlib.h>
 
 #include <errno.h>
-
-#include "xalloc-oversized.h"
+#include <stdckdint.h>
 
 /* Allocate an N-byte block of memory from the heap, even if N is 0.  */
 
@@ -34,7 +33,8 @@ rpl_malloc (size_t n)
   if (n == 0)
     n = 1;
 
-  if (xalloc_oversized (n, 1))
+  ptrdiff_t signed_n;
+  if (ckd_add (&signed_n, n, 0))
     {
       errno = ENOMEM;
       return NULL;
index 95227241d0debaf9c4682b11f79e494fa9973985..13b26693b78a33c1c5b632f6a74ee5babf1d9b17 100644 (file)
@@ -7,7 +7,7 @@ lib/malloc.c
 Depends-on:
 malloc-posix
 extensions-aix
-xalloc-oversized     [test $REPLACE_MALLOC_FOR_MALLOC_GNU = 1]
+stdckdint            [test $REPLACE_CALLOC_FOR_MALLOC_GNU = 1]
 
 configure.ac:
 gl_FUNC_MALLOC_GNU
index 86687aa8aaad6da8e51296ac03d674ce7b8d637e..a3efe4ca7b53ca8d02f554e58e262e86760cd249 100644 (file)
@@ -6,8 +6,8 @@ lib/malloc.c
 m4/malloc.m4
 
 Depends-on:
+stdckdint            [test $REPLACE_CALLOC_FOR_MALLOC_POSIX = 1]
 stdlib
-xalloc-oversized     [test $REPLACE_MALLOC_FOR_MALLOC_POSIX = 1]
 
 configure.ac:
 AC_REQUIRE([gl_FUNC_MALLOC_POSIX])