Paul Eggert wrote:
> diff --git a/m4/realloc.m4 b/m4/realloc.m4
> index 639d7a9efe..4a3f2ea8ae 100644
> --- a/m4/realloc.m4
> +++ b/m4/realloc.m4
> ...
> @@ -70,19 +33,45 @@ AC_DEFUN([gl_FUNC_REALLOC_POSIX],
>      AC_DEFINE([NEED_SANITIZED_REALLOC], [1],
>        [Define to 1 if realloc should abort upon undefined behaviour.])
>    else
> -    if test $REPLACE_MALLOC_FOR_MALLOC_POSIX = 1; then
> -      REPLACE_REALLOC_FOR_REALLOC_POSIX=1
> -    fi
> +    REPLACE_REALLOC_FOR_REALLOC_POSIX=$REPLACE_MALLOC_FOR_MALLOC_POSIX
>    fi
>  ])

This change is not wrong. But it made the code more fragile: Its correctness
now depends on the fact that gl_FUNC_REALLOC_POSIX is AC_REQUIREd before
the assignments in line 78 and line 80. This is one more thing to watch out
in future refactorings. I generally favour code that is a bit more verbose
if it can avoid future bugs.

Bruno




Reply via email to