aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorthegeorg <thegeorg@yandex-team.com>2024-10-16 20:31:26 +0300
committerthegeorg <thegeorg@yandex-team.com>2024-10-16 20:59:37 +0300
commit03b7b1db2e171b9eec29785d6546fc84b9881948 (patch)
tree26e0eb6fc6809175a920213733210b78c38fa443
parent3001482be58db30241c1590e7cee82845651d634 (diff)
downloadydb-03b7b1db2e171b9eec29785d6546fc84b9881948.tar.gz
Remove more unused sources from contrib/tools/m4
commit_hash:eed3e8af9d590cc0006acb8b733df8027b97e3ce
-rw-r--r--contrib/tools/m4/lib/mbrtowc.c402
-rw-r--r--contrib/tools/m4/lib/printf.c40
-rw-r--r--contrib/tools/m4/lib/realloc.c79
-rw-r--r--contrib/tools/m4/lib/same-inode.h33
-rw-r--r--contrib/tools/m4/lib/stpcpy.c50
-rw-r--r--contrib/tools/m4/lib/streq.h176
-rw-r--r--contrib/tools/m4/lib/unsetenv.c127
-rw-r--r--contrib/tools/m4/lib/ya.make4
8 files changed, 0 insertions, 911 deletions
diff --git a/contrib/tools/m4/lib/mbrtowc.c b/contrib/tools/m4/lib/mbrtowc.c
deleted file mode 100644
index 5ee44aea48..0000000000
--- a/contrib/tools/m4/lib/mbrtowc.c
+++ /dev/null
@@ -1,402 +0,0 @@
-/* Convert multibyte character to wide character.
- Copyright (C) 1999-2002, 2005-2013 Free Software Foundation, Inc.
- Written by Bruno Haible <bruno@clisp.org>, 2008.
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program 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 General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-#include <config.h>
-
-/* Specification. */
-#include <wchar.h>
-
-#if GNULIB_defined_mbstate_t
-/* Implement mbrtowc() on top of mbtowc(). */
-
-# include <errno.h>
-# include <stdlib.h>
-
-# include "localcharset.h"
-# include "streq.h"
-# include "verify.h"
-
-
-verify (sizeof (mbstate_t) >= 4);
-
-static char internal_state[4];
-
-size_t
-mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)
-{
- char *pstate = (char *)ps;
-
- if (s == NULL)
- {
- pwc = NULL;
- s = "";
- n = 1;
- }
-
- if (n == 0)
- return (size_t)(-2);
-
- /* Here n > 0. */
-
- if (pstate == NULL)
- pstate = internal_state;
-
- {
- size_t nstate = pstate[0];
- char buf[4];
- const char *p;
- size_t m;
-
- switch (nstate)
- {
- case 0:
- p = s;
- m = n;
- break;
- case 3:
- buf[2] = pstate[3];
- /*FALLTHROUGH*/
- case 2:
- buf[1] = pstate[2];
- /*FALLTHROUGH*/
- case 1:
- buf[0] = pstate[1];
- p = buf;
- m = nstate;
- buf[m++] = s[0];
- if (n >= 2 && m < 4)
- {
- buf[m++] = s[1];
- if (n >= 3 && m < 4)
- buf[m++] = s[2];
- }
- break;
- default:
- errno = EINVAL;
- return (size_t)(-1);
- }
-
- /* Here m > 0. */
-
-# if __GLIBC__ || defined __UCLIBC__
- /* Work around bug <http://sourceware.org/bugzilla/show_bug.cgi?id=9674> */
- mbtowc (NULL, NULL, 0);
-# endif
- {
- int res = mbtowc (pwc, p, m);
-
- if (res >= 0)
- {
- if (pwc != NULL && ((*pwc == 0) != (res == 0)))
- abort ();
- if (nstate >= (res > 0 ? res : 1))
- abort ();
- res -= nstate;
- pstate[0] = 0;
- return res;
- }
-
- /* mbtowc does not distinguish between invalid and incomplete multibyte
- sequences. But mbrtowc needs to make this distinction.
- There are two possible approaches:
- - Use iconv() and its return value.
- - Use built-in knowledge about the possible encodings.
- Given the low quality of implementation of iconv() on the systems that
- lack mbrtowc(), we use the second approach.
- The possible encodings are:
- - 8-bit encodings,
- - EUC-JP, EUC-KR, GB2312, EUC-TW, BIG5, GB18030, SJIS,
- - UTF-8.
- Use specialized code for each. */
- if (m >= 4 || m >= MB_CUR_MAX)
- goto invalid;
- /* Here MB_CUR_MAX > 1 and 0 < m < 4. */
- {
- const char *encoding = locale_charset ();
-
- if (STREQ_OPT (encoding, "UTF-8", 'U', 'T', 'F', '-', '8', 0, 0, 0, 0))
- {
- /* Cf. unistr/u8-mblen.c. */
- unsigned char c = (unsigned char) p[0];
-
- if (c >= 0xc2)
- {
- if (c < 0xe0)
- {
- if (m == 1)
- goto incomplete;
- }
- else if (c < 0xf0)
- {
- if (m == 1)
- goto incomplete;
- if (m == 2)
- {
- unsigned char c2 = (unsigned char) p[1];
-
- if ((c2 ^ 0x80) < 0x40
- && (c >= 0xe1 || c2 >= 0xa0)
- && (c != 0xed || c2 < 0xa0))
- goto incomplete;
- }
- }
- else if (c <= 0xf4)
- {
- if (m == 1)
- goto incomplete;
- else /* m == 2 || m == 3 */
- {
- unsigned char c2 = (unsigned char) p[1];
-
- if ((c2 ^ 0x80) < 0x40
- && (c >= 0xf1 || c2 >= 0x90)
- && (c < 0xf4 || (c == 0xf4 && c2 < 0x90)))
- {
- if (m == 2)
- goto incomplete;
- else /* m == 3 */
- {
- unsigned char c3 = (unsigned char) p[2];
-
- if ((c3 ^ 0x80) < 0x40)
- goto incomplete;
- }
- }
- }
- }
- }
- goto invalid;
- }
-
- /* As a reference for this code, you can use the GNU libiconv
- implementation. Look for uses of the RET_TOOFEW macro. */
-
- if (STREQ_OPT (encoding,
- "EUC-JP", 'E', 'U', 'C', '-', 'J', 'P', 0, 0, 0))
- {
- if (m == 1)
- {
- unsigned char c = (unsigned char) p[0];
-
- if ((c >= 0xa1 && c < 0xff) || c == 0x8e || c == 0x8f)
- goto incomplete;
- }
- if (m == 2)
- {
- unsigned char c = (unsigned char) p[0];
-
- if (c == 0x8f)
- {
- unsigned char c2 = (unsigned char) p[1];
-
- if (c2 >= 0xa1 && c2 < 0xff)
- goto incomplete;
- }
- }
- goto invalid;
- }
- if (STREQ_OPT (encoding,
- "EUC-KR", 'E', 'U', 'C', '-', 'K', 'R', 0, 0, 0)
- || STREQ_OPT (encoding,
- "GB2312", 'G', 'B', '2', '3', '1', '2', 0, 0, 0)
- || STREQ_OPT (encoding,
- "BIG5", 'B', 'I', 'G', '5', 0, 0, 0, 0, 0))
- {
- if (m == 1)
- {
- unsigned char c = (unsigned char) p[0];
-
- if (c >= 0xa1 && c < 0xff)
- goto incomplete;
- }
- goto invalid;
- }
- if (STREQ_OPT (encoding,
- "EUC-TW", 'E', 'U', 'C', '-', 'T', 'W', 0, 0, 0))
- {
- if (m == 1)
- {
- unsigned char c = (unsigned char) p[0];
-
- if ((c >= 0xa1 && c < 0xff) || c == 0x8e)
- goto incomplete;
- }
- else /* m == 2 || m == 3 */
- {
- unsigned char c = (unsigned char) p[0];
-
- if (c == 0x8e)
- goto incomplete;
- }
- goto invalid;
- }
- if (STREQ_OPT (encoding,
- "GB18030", 'G', 'B', '1', '8', '0', '3', '0', 0, 0))
- {
- if (m == 1)
- {
- unsigned char c = (unsigned char) p[0];
-
- if ((c >= 0x90 && c <= 0xe3) || (c >= 0xf8 && c <= 0xfe))
- goto incomplete;
- }
- else /* m == 2 || m == 3 */
- {
- unsigned char c = (unsigned char) p[0];
-
- if (c >= 0x90 && c <= 0xe3)
- {
- unsigned char c2 = (unsigned char) p[1];
-
- if (c2 >= 0x30 && c2 <= 0x39)
- {
- if (m == 2)
- goto incomplete;
- else /* m == 3 */
- {
- unsigned char c3 = (unsigned char) p[2];
-
- if (c3 >= 0x81 && c3 <= 0xfe)
- goto incomplete;
- }
- }
- }
- }
- goto invalid;
- }
- if (STREQ_OPT (encoding, "SJIS", 'S', 'J', 'I', 'S', 0, 0, 0, 0, 0))
- {
- if (m == 1)
- {
- unsigned char c = (unsigned char) p[0];
-
- if ((c >= 0x81 && c <= 0x9f) || (c >= 0xe0 && c <= 0xea)
- || (c >= 0xf0 && c <= 0xf9))
- goto incomplete;
- }
- goto invalid;
- }
-
- /* An unknown multibyte encoding. */
- goto incomplete;
- }
-
- incomplete:
- {
- size_t k = nstate;
- /* Here 0 <= k < m < 4. */
- pstate[++k] = s[0];
- if (k < m)
- {
- pstate[++k] = s[1];
- if (k < m)
- pstate[++k] = s[2];
- }
- if (k != m)
- abort ();
- }
- pstate[0] = m;
- return (size_t)(-2);
-
- invalid:
- errno = EILSEQ;
- /* The conversion state is undefined, says POSIX. */
- return (size_t)(-1);
- }
- }
-}
-
-#else
-/* Override the system's mbrtowc() function. */
-
-# undef mbrtowc
-
-size_t
-rpl_mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)
-{
-# if MBRTOWC_NULL_ARG2_BUG || MBRTOWC_RETVAL_BUG
- if (s == NULL)
- {
- pwc = NULL;
- s = "";
- n = 1;
- }
-# endif
-
-# if MBRTOWC_RETVAL_BUG
- {
- static mbstate_t internal_state;
-
- /* Override mbrtowc's internal state. We cannot call mbsinit() on the
- hidden internal state, but we can call it on our variable. */
- if (ps == NULL)
- ps = &internal_state;
-
- if (!mbsinit (ps))
- {
- /* Parse the rest of the multibyte character byte for byte. */
- size_t count = 0;
- for (; n > 0; s++, n--)
- {
- wchar_t wc;
- size_t ret = mbrtowc (&wc, s, 1, ps);
-
- if (ret == (size_t)(-1))
- return (size_t)(-1);
- count++;
- if (ret != (size_t)(-2))
- {
- /* The multibyte character has been completed. */
- if (pwc != NULL)
- *pwc = wc;
- return (wc == 0 ? 0 : count);
- }
- }
- return (size_t)(-2);
- }
- }
-# endif
-
-# if MBRTOWC_NUL_RETVAL_BUG
- {
- wchar_t wc;
- size_t ret = mbrtowc (&wc, s, n, ps);
-
- if (ret != (size_t)(-1) && ret != (size_t)(-2))
- {
- if (pwc != NULL)
- *pwc = wc;
- if (wc == 0)
- ret = 0;
- }
- return ret;
- }
-# else
- {
-# if MBRTOWC_NULL_ARG1_BUG
- wchar_t dummy;
-
- if (pwc == NULL)
- pwc = &dummy;
-# endif
-
- return mbrtowc (pwc, s, n, ps);
- }
-# endif
-}
-
-#endif
diff --git a/contrib/tools/m4/lib/printf.c b/contrib/tools/m4/lib/printf.c
deleted file mode 100644
index 7f682497cc..0000000000
--- a/contrib/tools/m4/lib/printf.c
+++ /dev/null
@@ -1,40 +0,0 @@
-/* Formatted output to a stream.
- Copyright (C) 2007, 2010-2013 Free Software Foundation, Inc.
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program 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 General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-#if 1
-# include <config.h>
-#endif
-
-/* Specification. */
-#include <stdio.h>
-
-#include <stdarg.h>
-
-/* Print formatted output to standard output.
- Return string length of formatted string. On error, return a negative
- value. */
-int
-printf (const char *format, ...)
-{
- int retval;
- va_list args;
-
- va_start (args, format);
- retval = vfprintf (stdout, format, args);
- va_end (args);
-
- return retval;
-}
diff --git a/contrib/tools/m4/lib/realloc.c b/contrib/tools/m4/lib/realloc.c
deleted file mode 100644
index b51010a621..0000000000
--- a/contrib/tools/m4/lib/realloc.c
+++ /dev/null
@@ -1,79 +0,0 @@
-/* realloc() function that is glibc compatible.
-
- Copyright (C) 1997, 2003-2004, 2006-2007, 2009-2013 Free Software
- Foundation, Inc.
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program 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 General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-/* written by Jim Meyering and Bruno Haible */
-
-#define _GL_USE_STDLIB_ALLOC 1
-#include <config.h>
-
-/* Only the AC_FUNC_REALLOC macro defines 'realloc' already in config.h. */
-#ifdef realloc
-# define NEED_REALLOC_GNU 1
-/* Whereas the gnulib module 'realloc-gnu' defines HAVE_REALLOC_GNU. */
-#elif GNULIB_REALLOC_GNU && !HAVE_REALLOC_GNU
-# define NEED_REALLOC_GNU 1
-#endif
-
-/* Infer the properties of the system's malloc function.
- The gnulib module 'malloc-gnu' defines HAVE_MALLOC_GNU. */
-#if GNULIB_MALLOC_GNU && HAVE_MALLOC_GNU
-# define SYSTEM_MALLOC_GLIBC_COMPATIBLE 1
-#endif
-
-#include <stdlib.h>
-
-#include <errno.h>
-
-/* Change the size of an allocated block of memory P to N bytes,
- with error checking. If N is zero, change it to 1. If P is NULL,
- use malloc. */
-
-void *
-rpl_realloc (void *p, size_t n)
-{
- void *result;
-
-#if NEED_REALLOC_GNU
- if (n == 0)
- {
- n = 1;
-
- /* In theory realloc might fail, so don't rely on it to free. */
- free (p);
- p = NULL;
- }
-#endif
-
- if (p == NULL)
- {
-#if GNULIB_REALLOC_GNU && !NEED_REALLOC_GNU && !SYSTEM_MALLOC_GLIBC_COMPATIBLE
- if (n == 0)
- n = 1;
-#endif
- result = malloc (n);
- }
- else
- result = realloc (p, n);
-
-#if !HAVE_REALLOC_POSIX
- if (result == NULL)
- errno = ENOMEM;
-#endif
-
- return result;
-}
diff --git a/contrib/tools/m4/lib/same-inode.h b/contrib/tools/m4/lib/same-inode.h
deleted file mode 100644
index 3843b07078..0000000000
--- a/contrib/tools/m4/lib/same-inode.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/* Determine whether two stat buffers refer to the same file.
-
- Copyright (C) 2006, 2009-2013 Free Software Foundation, Inc.
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program 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 General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-#ifndef SAME_INODE_H
-# define SAME_INODE_H 1
-
-# ifdef __VMS
-# define SAME_INODE(a, b) \
- ((a).st_ino[0] == (b).st_ino[0] \
- && (a).st_ino[1] == (b).st_ino[1] \
- && (a).st_ino[2] == (b).st_ino[2] \
- && (a).st_dev == (b).st_dev)
-# else
-# define SAME_INODE(a, b) \
- ((a).st_ino == (b).st_ino \
- && (a).st_dev == (b).st_dev)
-# endif
-
-#endif
diff --git a/contrib/tools/m4/lib/stpcpy.c b/contrib/tools/m4/lib/stpcpy.c
deleted file mode 100644
index f5aa8d67e9..0000000000
--- a/contrib/tools/m4/lib/stpcpy.c
+++ /dev/null
@@ -1,50 +0,0 @@
-/* stpcpy.c -- copy a string and return pointer to end of new string
- Copyright (C) 1992, 1995, 1997-1998, 2006, 2009-2013 Free Software
- Foundation, Inc.
-
- NOTE: The canonical source of this file is maintained with the GNU C Library.
- Bugs can be reported to bug-glibc@prep.ai.mit.edu.
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the
- Free Software Foundation; either version 3 of the License, or any
- later version.
-
- This program 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 General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-#include <config.h>
-
-#include <string.h>
-#include <stdlib.h>
-
-#undef __stpcpy
-#if defined(_LIBC) || (defined(__MACH__) && defined(stpcpy))
-# undef stpcpy
-#endif
-
-#ifndef weak_alias
-# define __stpcpy stpcpy
-#endif
-
-/* Copy SRC to DEST, returning the address of the terminating '\0' in DEST. */
-char *
-__stpcpy (char *dest, const char *src)
-{
- char *d = dest;
- const char *s = src;
-
- do
- *d++ = *s;
- while (*s++ != '\0');
-
- return d - 1;
-}
-#ifdef weak_alias
-weak_alias (__stpcpy, stpcpy)
-#endif
diff --git a/contrib/tools/m4/lib/streq.h b/contrib/tools/m4/lib/streq.h
deleted file mode 100644
index 12c1867c83..0000000000
--- a/contrib/tools/m4/lib/streq.h
+++ /dev/null
@@ -1,176 +0,0 @@
-/* Optimized string comparison.
- Copyright (C) 2001-2002, 2007, 2009-2013 Free Software Foundation, Inc.
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published
- by the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program 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
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-/* Written by Bruno Haible <bruno@clisp.org>. */
-
-#ifndef _GL_STREQ_H
-#define _GL_STREQ_H
-
-#include <string.h>
-
-/* STREQ_OPT allows to optimize string comparison with a small literal string.
- STREQ_OPT (s, "EUC-KR", 'E', 'U', 'C', '-', 'K', 'R', 0, 0, 0)
- is semantically equivalent to
- strcmp (s, "EUC-KR") == 0
- just faster. */
-
-/* Help GCC to generate good code for string comparisons with
- immediate strings. */
-#if defined (__GNUC__) && defined (__OPTIMIZE__)
-
-static inline int
-streq9 (const char *s1, const char *s2)
-{
- return strcmp (s1 + 9, s2 + 9) == 0;
-}
-
-static inline int
-streq8 (const char *s1, const char *s2, char s28)
-{
- if (s1[8] == s28)
- {
- if (s28 == 0)
- return 1;
- else
- return streq9 (s1, s2);
- }
- else
- return 0;
-}
-
-static inline int
-streq7 (const char *s1, const char *s2, char s27, char s28)
-{
- if (s1[7] == s27)
- {
- if (s27 == 0)
- return 1;
- else
- return streq8 (s1, s2, s28);
- }
- else
- return 0;
-}
-
-static inline int
-streq6 (const char *s1, const char *s2, char s26, char s27, char s28)
-{
- if (s1[6] == s26)
- {
- if (s26 == 0)
- return 1;
- else
- return streq7 (s1, s2, s27, s28);
- }
- else
- return 0;
-}
-
-static inline int
-streq5 (const char *s1, const char *s2, char s25, char s26, char s27, char s28)
-{
- if (s1[5] == s25)
- {
- if (s25 == 0)
- return 1;
- else
- return streq6 (s1, s2, s26, s27, s28);
- }
- else
- return 0;
-}
-
-static inline int
-streq4 (const char *s1, const char *s2, char s24, char s25, char s26, char s27, char s28)
-{
- if (s1[4] == s24)
- {
- if (s24 == 0)
- return 1;
- else
- return streq5 (s1, s2, s25, s26, s27, s28);
- }
- else
- return 0;
-}
-
-static inline int
-streq3 (const char *s1, const char *s2, char s23, char s24, char s25, char s26, char s27, char s28)
-{
- if (s1[3] == s23)
- {
- if (s23 == 0)
- return 1;
- else
- return streq4 (s1, s2, s24, s25, s26, s27, s28);
- }
- else
- return 0;
-}
-
-static inline int
-streq2 (const char *s1, const char *s2, char s22, char s23, char s24, char s25, char s26, char s27, char s28)
-{
- if (s1[2] == s22)
- {
- if (s22 == 0)
- return 1;
- else
- return streq3 (s1, s2, s23, s24, s25, s26, s27, s28);
- }
- else
- return 0;
-}
-
-static inline int
-streq1 (const char *s1, const char *s2, char s21, char s22, char s23, char s24, char s25, char s26, char s27, char s28)
-{
- if (s1[1] == s21)
- {
- if (s21 == 0)
- return 1;
- else
- return streq2 (s1, s2, s22, s23, s24, s25, s26, s27, s28);
- }
- else
- return 0;
-}
-
-static inline int
-streq0 (const char *s1, const char *s2, char s20, char s21, char s22, char s23, char s24, char s25, char s26, char s27, char s28)
-{
- if (s1[0] == s20)
- {
- if (s20 == 0)
- return 1;
- else
- return streq1 (s1, s2, s21, s22, s23, s24, s25, s26, s27, s28);
- }
- else
- return 0;
-}
-
-#define STREQ_OPT(s1,s2,s20,s21,s22,s23,s24,s25,s26,s27,s28) \
- streq0 (s1, s2, s20, s21, s22, s23, s24, s25, s26, s27, s28)
-
-#else
-
-#define STREQ_OPT(s1,s2,s20,s21,s22,s23,s24,s25,s26,s27,s28) \
- (strcmp (s1, s2) == 0)
-
-#endif
-
-#endif /* _GL_STREQ_H */
diff --git a/contrib/tools/m4/lib/unsetenv.c b/contrib/tools/m4/lib/unsetenv.c
deleted file mode 100644
index cfb800a992..0000000000
--- a/contrib/tools/m4/lib/unsetenv.c
+++ /dev/null
@@ -1,127 +0,0 @@
-/* Copyright (C) 1992, 1995-2002, 2005-2013 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program 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 General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-/* Don't use __attribute__ __nonnull__ in this compilation unit. Otherwise gcc
- optimizes away the name == NULL test below. */
-#define _GL_ARG_NONNULL(params)
-
-#include <config.h>
-
-/* Specification. */
-#include <stdlib.h>
-
-#include <errno.h>
-#if !_LIBC
-# define __set_errno(ev) ((errno) = (ev))
-#endif
-
-#include <string.h>
-#include <unistd.h>
-
-#if !_LIBC
-# define __environ environ
-#endif
-
-#if _LIBC
-/* This lock protects against simultaneous modifications of 'environ'. */
-# error #include <bits/libc-lock.h>
-__libc_lock_define_initialized (static, envlock)
-# define LOCK __libc_lock_lock (envlock)
-# define UNLOCK __libc_lock_unlock (envlock)
-#else
-# define LOCK
-# define UNLOCK
-#endif
-
-/* In the GNU C library we must keep the namespace clean. */
-#ifdef _LIBC
-# define unsetenv __unsetenv
-#endif
-
-#if _LIBC || !HAVE_UNSETENV
-
-int
-unsetenv (const char *name)
-{
- size_t len;
- char **ep;
-
- if (name == NULL || *name == '\0' || strchr (name, '=') != NULL)
- {
- __set_errno (EINVAL);
- return -1;
- }
-
- len = strlen (name);
-
- LOCK;
-
- ep = __environ;
- while (*ep != NULL)
- if (!strncmp (*ep, name, len) && (*ep)[len] == '=')
- {
- /* Found it. Remove this pointer by moving later ones back. */
- char **dp = ep;
-
- do
- dp[0] = dp[1];
- while (*dp++);
- /* Continue the loop in case NAME appears again. */
- }
- else
- ++ep;
-
- UNLOCK;
-
- return 0;
-}
-
-#ifdef _LIBC
-# undef unsetenv
-weak_alias (__unsetenv, unsetenv)
-#endif
-
-#else /* HAVE_UNSETENV */
-
-# undef unsetenv
-# if !HAVE_DECL_UNSETENV
-# if VOID_UNSETENV
-extern void unsetenv (const char *);
-# else
-extern int unsetenv (const char *);
-# endif
-# endif
-
-/* Call the underlying unsetenv, in case there is hidden bookkeeping
- that needs updating beyond just modifying environ. */
-int
-rpl_unsetenv (const char *name)
-{
- int result = 0;
- if (!name || !*name || strchr (name, '='))
- {
- errno = EINVAL;
- return -1;
- }
- while (getenv (name))
-# if !VOID_UNSETENV
- result =
-# endif
- unsetenv (name);
- return result;
-}
-
-#endif /* HAVE_UNSETENV */
diff --git a/contrib/tools/m4/lib/ya.make b/contrib/tools/m4/lib/ya.make
index ccb5f20ba0..064696e644 100644
--- a/contrib/tools/m4/lib/ya.make
+++ b/contrib/tools/m4/lib/ya.make
@@ -90,7 +90,6 @@ SRCS(
localcharset.c
lseek.c
malloca.c
- mbrtowc.c
memchr2.c
mkstemp-safer.c
nl_langinfo.c
@@ -103,19 +102,16 @@ SRCS(
progname.c
quotearg.c
raise.c
- realloc.c
regex.c
rmdir.c
secure_getenv.c
sig-handler.c
spawn-pipe.c
stat.c
- stpcpy.c
stripslash.c
tempname.c
tmpdir.c
unistd.c
- unsetenv.c
vasnprintf.c
verror.c
version-etc-fsf.c