From 56c8e85b713d588a95a2ae9ef3c47efe8b5e5828 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Tue, 5 Nov 2024 15:53:47 +0100 Subject: [PATCH] calloc, malloc: Fix a comment. * m4/malloc.m4 (gl_FUNC_MALLOC_GNU): Mention that it sets HAVE_MALLOC_PTRDIFF. (gl_FUNC_MALLOC_PTRDIFF): Likewise. (gl_CHECK_MALLOC_PTRDIFF): Do not mention HAVE_MALLOC_PTRDIFF here. --- ChangeLog | 6 ++++++ m4/malloc.m4 | 17 +++++++++++------ 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0d9114ca3c..aca62308e0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2024-11-05 Bruno Haible + calloc, malloc: Fix a comment. + * m4/malloc.m4 (gl_FUNC_MALLOC_GNU): Mention that it sets + HAVE_MALLOC_PTRDIFF. + (gl_FUNC_MALLOC_PTRDIFF): Likewise. + (gl_CHECK_MALLOC_PTRDIFF): Do not mention HAVE_MALLOC_PTRDIFF here. + calloc: Fix configure test (regression yesterday). * m4/calloc.m4 (gl_FUNC_CALLOC_IF): Fix wrong cache variable name. Rename cache variable. Restore earlier comment. diff --git a/m4/malloc.m4 b/m4/malloc.m4 index deb0de24de..bad5ee9501 100644 --- a/m4/malloc.m4 +++ b/m4/malloc.m4 @@ -1,5 +1,5 @@ # malloc.m4 -# serial 41 +# serial 42 dnl Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -45,8 +45,12 @@ AC_DEFUN([_AC_FUNC_MALLOC_IF], # gl_FUNC_MALLOC_GNU # ------------------ -# Define HAVE_MALLOC_0_NONNULL if malloc (0) returns nonnull. -# Replace malloc if it is not compatible with GNU libc. +# Test whether malloc (0) is compatible with GNU libc. +# Replace malloc if not. +# Define HAVE_MALLOC_0_NONNULL if malloc (0) returns nonnull (except upon +# out-of-memory). +# Define HAVE_MALLOC_PTRDIFF if malloc (N) reliably fails when N exceeds +# PTRDIFF_MAX. AC_DEFUN([gl_FUNC_MALLOC_GNU], [ AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) @@ -66,8 +70,9 @@ AC_DEFUN([gl_FUNC_MALLOC_GNU], # gl_FUNC_MALLOC_PTRDIFF # ---------------------- -# Test whether malloc (N) reliably fails when N exceeds PTRDIFF_MAX, -# and replace malloc otherwise. +# Test whether malloc (N) reliably fails when N exceeds PTRDIFF_MAX. +# Define HAVE_MALLOC_PTRDIFF if yes. +# Replace malloc if not. AC_DEFUN([gl_FUNC_MALLOC_PTRDIFF], [ AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) @@ -81,7 +86,7 @@ AC_DEFUN([gl_FUNC_MALLOC_PTRDIFF], # Test whether malloc, realloc, calloc refuse to create objects # larger than what can be expressed in ptrdiff_t. -# Set gl_cv_func_malloc_gnu and define MALLOC_PTRDIFF accordingly. +# Set gl_cv_func_malloc_gnu. AC_DEFUN([gl_CHECK_MALLOC_PTRDIFF], [ AC_CACHE_CHECK([whether malloc is ptrdiff_t safe], -- 2.39.5