Files
RedBear-OS/local/recipes/tools/diffutils/source/m4/realloc.m4
T
vasilito 068a1ca63e bootloader: rebase onto upstream 1.0.0, sync firmware-loader version
Bootloader fork rebase:
- Base changed from 0.1.0 pre-patched archive to upstream 1.0.0 tag (c7eeb9f)
- Applied 0001-redbear-local-forks.patch (Cargo.toml crate path redirects)
- Applied fix-uefi-alloc-panic.patch equivalents (4 panic!() -> graceful
  error handling in src/main.rs)
- Applied P5-live-preload-cap-1gib.patch (1 GiB cap on live image preload)
- Skipped: P0 GPT partition scan (requires new module + integration),
  P1 timeout/default-resolution, P2 live preload guard (subsumed by
  panic fixes + cap), P3 live image safe read, P4 large ISO boot,
  redox.patch — to be applied in dedicated rebase session.

firmware-loader/Cargo.toml: version 0.1.0 -> 0.3.0 (sync with other
Red Bear custom crates which are at 0.3.0).

fork-upstream-map.toml: bootloader back from PENDING_REBASE to 1.0.0
since the partial rebase matches upstream 1.0.0 content.

fork-upstream-map.toml: base restored to 'main' tracked (was correctly
tracked by build-redbear.sh).
2026-07-11 09:47:59 +03:00

86 lines
3.4 KiB
Plaintext

# realloc.m4
# serial 39
dnl Copyright (C) 2007, 2009-2025 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
dnl This file is offered as-is, without any warranty.
# An an experimental option, the user can request a sanitized realloc()
# implementation, i.e. one that aborts upon undefined behaviour,
# by setting
# gl_cv_func_realloc_sanitize=yes
# at configure time.
AC_DEFUN([gl_FUNC_REALLOC_SANITIZED],
[
AC_CACHE_CHECK([whether realloc should abort upon undefined behaviour],
[gl_cv_func_realloc_sanitize],
[test -n "$gl_cv_func_realloc_sanitize" || gl_cv_func_realloc_sanitize=no])
])
# gl_FUNC_REALLOC_POSIX
# ---------------------
# Test whether 'realloc' is POSIX compliant (sets errno to ENOMEM when it
# fails, and doesn't mess up with ptrdiff_t overflow),
# and replace realloc if it is not.
AC_DEFUN([gl_FUNC_REALLOC_POSIX],
[
AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
AC_REQUIRE([gl_FUNC_MALLOC_POSIX])
AC_REQUIRE([gl_FUNC_REALLOC_SANITIZED])
if test "$gl_cv_func_realloc_sanitize" != no; then
REPLACE_REALLOC_FOR_REALLOC_POSIX=1
AC_DEFINE([NEED_SANITIZED_REALLOC], [1],
[Define to 1 if realloc should abort upon undefined behaviour.])
else
REPLACE_REALLOC_FOR_REALLOC_POSIX=$REPLACE_MALLOC_FOR_MALLOC_POSIX
fi
])
# gl_FUNC_REALLOC_0_NONNULL
# -------------------------
# Replace realloc if realloc (..., 0) returns null.
# Modules that use this macro directly or indirectly should depend
# on extensions-aix, so that _LINUX_SOURCE_COMPAT gets defined
# before this macro gets invoked. This helps if !(__VEC__ || __AIXVEC),
# and doesn't hurt otherwise.
AC_DEFUN([gl_FUNC_REALLOC_0_NONNULL],
[
AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
AC_REQUIRE([AC_CANONICAL_HOST])dnl for cross-compiles
AC_REQUIRE([gl_FUNC_REALLOC_POSIX])
AC_CACHE_CHECK([whether realloc (..., 0) returns nonnull],
[gl_cv_func_realloc_0_nonnull],
[AC_RUN_IFELSE(
[AC_LANG_PROGRAM(
[[#include <stdlib.h>
/* Use prealloc to test; "volatile" prevents the compiler
from optimizing the realloc call away. */
void *(*volatile prealloc) (void *, size_t) = realloc;]],
[[void *p = prealloc (0, 0);
int result = !p;
p = prealloc (p, 0);
result |= !p;
free (p);
return result;]])],
[gl_cv_func_realloc_0_nonnull=yes],
[gl_cv_func_realloc_0_nonnull=no],
[AS_CASE([$host_os],
[# Guess yes on platforms where we know the result.
freebsd* | netbsd* | openbsd* | darwin* | bitrig* \
| *-musl* | midipix* | midnightbsd* \
| hpux* | solaris* | cygwin*],
[gl_cv_func_realloc_0_nonnull="guessing yes"],
[# Guess as follows if we don't know.
gl_cv_func_realloc_0_nonnull=$gl_cross_guess_normal])])])
AS_CASE([$gl_cv_func_realloc_0_nonnull],
[*yes],
[AC_DEFINE([HAVE_REALLOC_0_NONNULL], [1],
[Define to 1 if realloc (..., 0) returns nonnull.])],
[AS_CASE([$gl_cv_func_realloc_sanitize,$gl_cv_malloc_ptrdiff,$gl_cv_func_malloc_posix,$host],
[yes,*,*,* | *,no,*,* | *,*,*no,* | *,*,*,aarch64c-*-freebsd*],
[REPLACE_REALLOC_FOR_REALLOC_POSIX=1],
[# Optimize for common case of glibc 2.1.1+ and compatibles.
REPLACE_REALLOC_FOR_REALLOC_POSIX=2])])
])