summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2025-12-09 12:55:17 -0800
committerPaul Eggert <eggert@cs.ucla.edu>2025-12-09 13:27:27 -0800
commit88bf047d39838393cd16f231e721c8b548a50f42 (patch)
tree822067e5af0d720d549eb5e00babd142d7d347f6 /lib
parentcc05493483a005074608f31a54e496599bd3b296 (diff)
Garbage-collect Gnulib sources
Remove Gnulib sources no longer needed or used. admin/merge-gnulib is typically not smart enough to do that. * configure.ac: Do not call gl_EEMALLOC, as it is no longer supplied or needed. * lib/explicit_bzero.c, lib/malloc/scratch_buffer_dupfree.c: * lib/xalloc-oversized.h, m4/eealloc.m4, m4/explicit_bzero.m4: * m4/st_dm_mode.m4, m4/year2038.m4: Remove.
Diffstat (limited to 'lib')
-rw-r--r--lib/explicit_bzero.c74
-rw-r--r--lib/malloc/scratch_buffer_dupfree.c41
-rw-r--r--lib/xalloc-oversized.h66
3 files changed, 0 insertions, 181 deletions
diff --git a/lib/explicit_bzero.c b/lib/explicit_bzero.c
deleted file mode 100644
index 59d9895abfe..00000000000
--- a/lib/explicit_bzero.c
+++ /dev/null
@@ -1,74 +0,0 @@
-/* Erasure of sensitive data, generic implementation.
- Copyright (C) 2016-2025 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <https://www.gnu.org/licenses/>. */
-
-/* An assembler implementation of explicit_bzero can be created as an
- assembler alias of an optimized bzero implementation.
- Architecture-specific implementations also need to define
- __explicit_bzero_chk. */
-
-#if !_LIBC
-# include <config.h>
-#endif
-
-/* memset_s need this define */
-#if HAVE_MEMSET_S
-# define __STDC_WANT_LIB_EXT1__ 1
-#endif
-
-#include <string.h>
-
-#if defined _WIN32 && !defined __CYGWIN__
-# define WIN32_LEAN_AND_MEAN
-# include <windows.h>
-#endif
-
-#if _LIBC
-/* glibc-internal users use __explicit_bzero_chk, and explicit_bzero
- redirects to that. */
-# undef explicit_bzero
-#endif
-
-/* Set LEN bytes of S to 0. The compiler will not delete a call to
- this function, even if S is dead after the call. */
-void
-explicit_bzero (void *s, size_t len)
-{
-#if defined _WIN32 && !defined __CYGWIN__
- (void) SecureZeroMemory (s, len);
-#elif HAVE_EXPLICIT_MEMSET
- explicit_memset (s, '\0', len);
-#elif HAVE_MEMSET_S
- (void) memset_s (s, len, '\0', len);
-#elif defined __GNUC__ && !defined __clang__
- memset (s, '\0', len);
- /* Compiler barrier. */
- asm volatile ("" ::: "memory");
-#elif defined __clang__
- memset (s, '\0', len);
- /* Compiler barrier. */
- /* With asm ("" ::: "memory") LLVM analyzes uses of 's' and finds that the
- whole thing is dead and eliminates it. Use 'g' to work around this
- problem. See <https://bugs.llvm.org/show_bug.cgi?id=15495#c11>. */
- __asm__ volatile ("" : : "g"(s) : "memory");
-#else
- /* Invoke memset through a volatile function pointer. This defeats compiler
- optimizations. */
- void * (* const volatile volatile_memset) (void *, int, size_t) = memset;
- (void) volatile_memset (s, '\0', len);
-#endif
-}
diff --git a/lib/malloc/scratch_buffer_dupfree.c b/lib/malloc/scratch_buffer_dupfree.c
deleted file mode 100644
index 0d31a765d5d..00000000000
--- a/lib/malloc/scratch_buffer_dupfree.c
+++ /dev/null
@@ -1,41 +0,0 @@
-/* Variable-sized buffer with on-stack default allocation.
- Copyright (C) 2020-2025 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <https://www.gnu.org/licenses/>. */
-
-#ifndef _LIBC
-# include <libc-config.h>
-#endif
-
-#include <scratch_buffer.h>
-#include <string.h>
-
-void *
-__libc_scratch_buffer_dupfree (struct scratch_buffer *buffer, size_t size)
-{
- void *data = buffer->data;
- if (data == buffer->__space.__c)
- {
- void *copy = malloc (size);
- return copy != NULL ? memcpy (copy, data, size) : NULL;
- }
- else
- {
- void *copy = realloc (data, size);
- return copy != NULL ? copy : data;
- }
-}
-libc_hidden_def (__libc_scratch_buffer_dupfree)
diff --git a/lib/xalloc-oversized.h b/lib/xalloc-oversized.h
deleted file mode 100644
index 808e97b8cae..00000000000
--- a/lib/xalloc-oversized.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/* xalloc-oversized.h -- memory allocation size checking
-
- Copyright (C) 1990-2000, 2003-2004, 2006-2025 Free Software
- Foundation, Inc.
-
- This file is free software: you can redistribute it and/or modify
- it under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- This file is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public License
- along with this program. If not, see <https://www.gnu.org/licenses/>. */
-
-#ifndef XALLOC_OVERSIZED_H_
-#define XALLOC_OVERSIZED_H_
-
-#include <stddef.h>
-#include <stdint.h>
-
-/* True if N * S does not fit into both ptrdiff_t and size_t.
- N and S should be nonnegative and free of side effects.
- This expands to a constant expression if N and S are both constants.
- By gnulib convention, SIZE_MAX represents overflow in size_t
- calculations, so the conservative size_t-based dividend to use here
- is SIZE_MAX - 1. */
-#define __xalloc_oversized(n, s) \
- ((s) != 0 \
- && (PTRDIFF_MAX < SIZE_MAX ? PTRDIFF_MAX : SIZE_MAX - 1) / (s) < (n))
-
-/* Return 1 if and only if an array of N objects, each of size S,
- cannot exist reliably because its total size in bytes would exceed
- MIN (PTRDIFF_MAX, SIZE_MAX - 1).
-
- N and S should be nonnegative and free of side effects.
-
- Warning: (xalloc_oversized (N, S) ? NULL : malloc (N * S)) can
- misbehave if N and S are both narrower than ptrdiff_t and size_t,
- and can be rewritten as (xalloc_oversized (N, S) ? NULL
- : malloc (N * (size_t) S)).
-
- This is a macro, not a function, so that it works even if an
- argument exceeds MAX (PTRDIFF_MAX, SIZE_MAX). */
-#if 7 <= __GNUC__ && !defined __clang__ && PTRDIFF_MAX < SIZE_MAX
-# define xalloc_oversized(n, s) \
- __builtin_mul_overflow_p (n, s, (ptrdiff_t) 1)
-#elif 5 <= __GNUC__ && !defined __clang__ && !defined __ICC \
- && PTRDIFF_MAX < SIZE_MAX
-# define xalloc_oversized(n, s) \
- (__builtin_constant_p (n) && __builtin_constant_p (s) \
- ? __xalloc_oversized (n, s) \
- : __extension__ \
- ({ ptrdiff_t __xalloc_count; \
- __builtin_mul_overflow (n, s, &__xalloc_count); }))
-
-/* Other compilers use integer division; this may be slower but is
- more portable. */
-#else
-# define xalloc_oversized(n, s) __xalloc_oversized (n, s)
-#endif
-
-#endif /* !XALLOC_OVERSIZED_H_ */