diff options
author | thegeorg <thegeorg@yandex-team.com> | 2024-10-06 01:16:29 +0300 |
---|---|---|
committer | thegeorg <thegeorg@yandex-team.com> | 2024-10-06 01:24:53 +0300 |
commit | da51ab7086a1a08759ce938c4324d129161a3902 (patch) | |
tree | b38a080ee5dc0abfabe63c5f9bfd8dac6756cf56 /contrib/tools/m4/lib | |
parent | 5c2309a6f4f50f3065c6978d501f98458d13d7f3 (diff) | |
download | ydb-da51ab7086a1a08759ce938c4324d129161a3902.tar.gz |
Remove more excessive sources from contrib/tools/m4
commit_hash:dd99d7b56bc41f58f74e83d573709ab7cf9ebac3
Diffstat (limited to 'contrib/tools/m4/lib')
-rw-r--r-- | contrib/tools/m4/lib/float.c | 33 | ||||
-rw-r--r-- | contrib/tools/m4/lib/fopen.c | 110 | ||||
-rw-r--r-- | contrib/tools/m4/lib/itold.c | 28 | ||||
-rw-r--r-- | contrib/tools/m4/lib/mkstemp.c | 50 | ||||
-rw-r--r-- | contrib/tools/m4/lib/rawmemchr.c | 136 | ||||
-rw-r--r-- | contrib/tools/m4/lib/stdio-write.c | 198 | ||||
-rw-r--r-- | contrib/tools/m4/lib/strdup.c | 54 | ||||
-rw-r--r-- | contrib/tools/m4/lib/wcrtomb.c | 56 | ||||
-rw-r--r-- | contrib/tools/m4/lib/wcwidth.c | 50 | ||||
-rw-r--r-- | contrib/tools/m4/lib/xconcat-filename.c | 41 | ||||
-rw-r--r-- | contrib/tools/m4/lib/ya.make | 15 |
11 files changed, 0 insertions, 771 deletions
diff --git a/contrib/tools/m4/lib/float.c b/contrib/tools/m4/lib/float.c deleted file mode 100644 index 366945fa38..0000000000 --- a/contrib/tools/m4/lib/float.c +++ /dev/null @@ -1,33 +0,0 @@ -/* Auxiliary definitions for <float.h>. - Copyright (C) 2011-2013 Free Software Foundation, Inc. - Written by Bruno Haible <bruno@clisp.org>, 2011. - - 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 <float.h> - -#if (defined _ARCH_PPC || defined _POWER) && (defined _AIX || defined __linux__) && (LDBL_MANT_DIG == 106) && defined __GNUC__ -const union gl_long_double_union gl_LDBL_MAX = - { { DBL_MAX, DBL_MAX / (double)134217728UL / (double)134217728UL } }; -#elif defined __i386__ -const union gl_long_double_union gl_LDBL_MAX = - { { 0xFFFFFFFF, 0xFFFFFFFF, 32766 } }; -#else -/* This declaration is solely to ensure that after preprocessing - this file is never empty. */ -typedef int dummy; -#endif diff --git a/contrib/tools/m4/lib/fopen.c b/contrib/tools/m4/lib/fopen.c deleted file mode 100644 index f9d6763d21..0000000000 --- a/contrib/tools/m4/lib/fopen.c +++ /dev/null @@ -1,110 +0,0 @@ -/* Open a stream to a file. - Copyright (C) 2007-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>, 2007. */ - -/* If the user's config.h happens to include <stdio.h>, let it include only - the system's <stdio.h> here, so that orig_fopen doesn't recurse to - rpl_fopen. */ -#define __need_FILE -#include <config.h> - -/* Get the original definition of fopen. It might be defined as a macro. */ -#include <stdio.h> -#undef __need_FILE - -static FILE * -orig_fopen (const char *filename, const char *mode) -{ - return fopen (filename, mode); -} - -/* Specification. */ -/* Write "stdio.h" here, not <stdio.h>, otherwise OSF/1 5.1 DTK cc eliminates - this include because of the preliminary #include <stdio.h> above. */ -#include "stdio.h" - -#include <errno.h> -#include <fcntl.h> -#include <string.h> -#include <unistd.h> -#include <sys/types.h> -#include <sys/stat.h> - -FILE * -rpl_fopen (const char *filename, const char *mode) -{ -#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ - if (strcmp (filename, "/dev/null") == 0) - filename = "NUL"; -#endif - -#if FOPEN_TRAILING_SLASH_BUG - /* If the filename ends in a slash and a mode that requires write access is - specified, then fail. - Rationale: POSIX <http://www.opengroup.org/susv3/basedefs/xbd_chap04.html> - says that - "A pathname that contains at least one non-slash character and that - ends with one or more trailing slashes shall be resolved as if a - single dot character ( '.' ) were appended to the pathname." - and - "The special filename dot shall refer to the directory specified by - its predecessor." - If the named file already exists as a directory, then if a mode that - requires write access is specified, fopen() must fail because POSIX - <http://www.opengroup.org/susv3/functions/fopen.html> says that it - fails with errno = EISDIR in this case. - If the named file does not exist or does not name a directory, then - fopen() must fail since the file does not contain a '.' directory. */ - { - size_t len = strlen (filename); - if (len > 0 && filename[len - 1] == '/') - { - int fd; - struct stat statbuf; - FILE *fp; - - if (mode[0] == 'w' || mode[0] == 'a') - { - errno = EISDIR; - return NULL; - } - - fd = open (filename, O_RDONLY); - if (fd < 0) - return NULL; - - if (fstat (fd, &statbuf) >= 0 && !S_ISDIR (statbuf.st_mode)) - { - close (fd); - errno = ENOTDIR; - return NULL; - } - - fp = fdopen (fd, mode); - if (fp == NULL) - { - int saved_errno = errno; - close (fd); - errno = saved_errno; - } - return fp; - } - } -# endif - - return orig_fopen (filename, mode); -} diff --git a/contrib/tools/m4/lib/itold.c b/contrib/tools/m4/lib/itold.c deleted file mode 100644 index 9aabc7e464..0000000000 --- a/contrib/tools/m4/lib/itold.c +++ /dev/null @@ -1,28 +0,0 @@ -/* Replacement for 'int' to 'long double' conversion routine. - Copyright (C) 2011-2013 Free Software Foundation, Inc. - Written by Bruno Haible <bruno@clisp.org>, 2011. - - 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 <float.h> - -void -_Qp_itoq (long double *result, int a) -{ - /* Convert from 'int' to 'double', then from 'double' to 'long double'. */ - *result = (double) a; -} diff --git a/contrib/tools/m4/lib/mkstemp.c b/contrib/tools/m4/lib/mkstemp.c deleted file mode 100644 index 7a9af6c8cc..0000000000 --- a/contrib/tools/m4/lib/mkstemp.c +++ /dev/null @@ -1,50 +0,0 @@ -/* Copyright (C) 1998-1999, 2001, 2005-2007, 2009-2013 Free Software - Foundation, Inc. - This file is derived from the one in 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/>. */ - -#if !_LIBC -# include <config.h> -#endif - -#include <stdlib.h> - -#if !_LIBC -# include "tempname.h" -# define __gen_tempname gen_tempname -# ifndef __GT_FILE -# define __GT_FILE GT_FILE -# endif -#endif - -#include <stdio.h> - -#ifndef __GT_FILE -# define __GT_FILE 0 -#endif - -/* Generate a unique temporary file name from XTEMPLATE. - The last six characters of XTEMPLATE must be "XXXXXX"; - they are replaced with a string that makes the file name unique. - Then open the file and return a fd. - - If you are creating temporary files which will later be removed, - consider using the clean-temp module, which avoids several pitfalls - of using mkstemp directly. */ -int -mkstemp (char *xtemplate) -{ - return __gen_tempname (xtemplate, 0, 0, __GT_FILE); -} diff --git a/contrib/tools/m4/lib/rawmemchr.c b/contrib/tools/m4/lib/rawmemchr.c deleted file mode 100644 index a0298ce64e..0000000000 --- a/contrib/tools/m4/lib/rawmemchr.c +++ /dev/null @@ -1,136 +0,0 @@ -/* Searching in a string. - Copyright (C) 2008-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/>. */ - -#include <config.h> - -/* Specification. */ -#include <string.h> - -/* Find the first occurrence of C in S. */ -void * -rawmemchr (const void *s, int c_in) -{ - /* On 32-bit hardware, choosing longword to be a 32-bit unsigned - long instead of a 64-bit uintmax_t tends to give better - performance. On 64-bit hardware, unsigned long is generally 64 - bits already. Change this typedef to experiment with - performance. */ - typedef unsigned long int longword; - - const unsigned char *char_ptr; - const longword *longword_ptr; - longword repeated_one; - longword repeated_c; - unsigned char c; - - c = (unsigned char) c_in; - - /* Handle the first few bytes by reading one byte at a time. - Do this until CHAR_PTR is aligned on a longword boundary. */ - for (char_ptr = (const unsigned char *) s; - (size_t) char_ptr % sizeof (longword) != 0; - ++char_ptr) - if (*char_ptr == c) - return (void *) char_ptr; - - longword_ptr = (const longword *) char_ptr; - - /* All these elucidatory comments refer to 4-byte longwords, - but the theory applies equally well to any size longwords. */ - - /* Compute auxiliary longword values: - repeated_one is a value which has a 1 in every byte. - repeated_c has c in every byte. */ - repeated_one = 0x01010101; - repeated_c = c | (c << 8); - repeated_c |= repeated_c << 16; - if (0xffffffffU < (longword) -1) - { - repeated_one |= repeated_one << 31 << 1; - repeated_c |= repeated_c << 31 << 1; - if (8 < sizeof (longword)) - { - size_t i; - - for (i = 64; i < sizeof (longword) * 8; i *= 2) - { - repeated_one |= repeated_one << i; - repeated_c |= repeated_c << i; - } - } - } - - /* Instead of the traditional loop which tests each byte, we will - test a longword at a time. The tricky part is testing if *any of - the four* bytes in the longword in question are equal to NUL or - c. We first use an xor with repeated_c. This reduces the task - to testing whether *any of the four* bytes in longword1 is zero. - - We compute tmp = - ((longword1 - repeated_one) & ~longword1) & (repeated_one << 7). - That is, we perform the following operations: - 1. Subtract repeated_one. - 2. & ~longword1. - 3. & a mask consisting of 0x80 in every byte. - Consider what happens in each byte: - - If a byte of longword1 is zero, step 1 and 2 transform it into 0xff, - and step 3 transforms it into 0x80. A carry can also be propagated - to more significant bytes. - - If a byte of longword1 is nonzero, let its lowest 1 bit be at - position k (0 <= k <= 7); so the lowest k bits are 0. After step 1, - the byte ends in a single bit of value 0 and k bits of value 1. - After step 2, the result is just k bits of value 1: 2^k - 1. After - step 3, the result is 0. And no carry is produced. - So, if longword1 has only non-zero bytes, tmp is zero. - Whereas if longword1 has a zero byte, call j the position of the least - significant zero byte. Then the result has a zero at positions 0, ..., - j-1 and a 0x80 at position j. We cannot predict the result at the more - significant bytes (positions j+1..3), but it does not matter since we - already have a non-zero bit at position 8*j+7. - - The test whether any byte in longword1 is zero is equivalent - to testing whether tmp is nonzero. - - This test can read beyond the end of a string, depending on where - C_IN is encountered. However, this is considered safe since the - initialization phase ensured that the read will be aligned, - therefore, the read will not cross page boundaries and will not - cause a fault. */ - - while (1) - { - longword longword1 = *longword_ptr ^ repeated_c; - - if ((((longword1 - repeated_one) & ~longword1) - & (repeated_one << 7)) != 0) - break; - longword_ptr++; - } - - char_ptr = (const unsigned char *) longword_ptr; - - /* At this point, we know that one of the sizeof (longword) bytes - starting at char_ptr is == c. On little-endian machines, we - could determine the first such byte without any further memory - accesses, just by looking at the tmp result from the last loop - iteration. But this does not work on big-endian machines. - Choose code that works in both cases. */ - - char_ptr = (unsigned char *) longword_ptr; - while (*char_ptr != c) - char_ptr++; - return (void *) char_ptr; -} diff --git a/contrib/tools/m4/lib/stdio-write.c b/contrib/tools/m4/lib/stdio-write.c deleted file mode 100644 index 68d54ce93e..0000000000 --- a/contrib/tools/m4/lib/stdio-write.c +++ /dev/null @@ -1,198 +0,0 @@ -/* POSIX compatible FILE stream write function. - Copyright (C) 2008-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 <stdio.h> - -/* Replace these functions only if module 'nonblocking' or module 'sigpipe' is - requested. */ -#if GNULIB_NONBLOCKING || GNULIB_SIGPIPE - -/* On native Windows platforms, SIGPIPE does not exist. When write() is - called on a pipe with no readers, WriteFile() fails with error - GetLastError() = ERROR_NO_DATA, and write() in consequence fails with - error EINVAL. This write() function is at the basis of the function - which flushes the buffer of a FILE stream. */ - -# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ - -# include <errno.h> -# include <signal.h> -# include <io.h> - -# define WIN32_LEAN_AND_MEAN /* avoid including junk */ -# include <windows.h> - -# include "msvc-nothrow.h" - -# if GNULIB_NONBLOCKING -# define CLEAR_ERRNO \ - errno = 0; -# define HANDLE_ENOSPC \ - if (errno == ENOSPC && ferror (stream)) \ - { \ - int fd = fileno (stream); \ - if (fd >= 0) \ - { \ - HANDLE h = (HANDLE) _get_osfhandle (fd); \ - if (GetFileType (h) == FILE_TYPE_PIPE) \ - { \ - /* h is a pipe or socket. */ \ - DWORD state; \ - if (GetNamedPipeHandleState (h, &state, NULL, NULL, \ - NULL, NULL, 0) \ - && (state & PIPE_NOWAIT) != 0) \ - /* h is a pipe in non-blocking mode. \ - Change errno from ENOSPC to EAGAIN. */ \ - errno = EAGAIN; \ - } \ - } \ - } \ - else -# else -# define CLEAR_ERRNO -# define HANDLE_ENOSPC -# endif - -# if GNULIB_SIGPIPE -# define CLEAR_LastError \ - SetLastError (0); -# define HANDLE_ERROR_NO_DATA \ - if (GetLastError () == ERROR_NO_DATA && ferror (stream)) \ - { \ - int fd = fileno (stream); \ - if (fd >= 0 \ - && GetFileType ((HANDLE) _get_osfhandle (fd)) \ - == FILE_TYPE_PIPE) \ - { \ - /* Try to raise signal SIGPIPE. */ \ - raise (SIGPIPE); \ - /* If it is currently blocked or ignored, change errno from \ - EINVAL to EPIPE. */ \ - errno = EPIPE; \ - } \ - } \ - else -# else -# define CLEAR_LastError -# define HANDLE_ERROR_NO_DATA -# endif - -# define CALL_WITH_SIGPIPE_EMULATION(RETTYPE, EXPRESSION, FAILED) \ - if (ferror (stream)) \ - return (EXPRESSION); \ - else \ - { \ - RETTYPE ret; \ - CLEAR_ERRNO \ - CLEAR_LastError \ - ret = (EXPRESSION); \ - if (FAILED) \ - { \ - HANDLE_ENOSPC \ - HANDLE_ERROR_NO_DATA \ - ; \ - } \ - return ret; \ - } - -# if !REPLACE_PRINTF_POSIX /* avoid collision with printf.c */ -int -printf (const char *format, ...) -{ - int retval; - va_list args; - - va_start (args, format); - retval = vfprintf (stdout, format, args); - va_end (args); - - return retval; -} -# endif - -# if !REPLACE_FPRINTF_POSIX /* avoid collision with fprintf.c */ -int -fprintf (FILE *stream, const char *format, ...) -{ - int retval; - va_list args; - - va_start (args, format); - retval = vfprintf (stream, format, args); - va_end (args); - - return retval; -} -# endif - -# if !REPLACE_VPRINTF_POSIX /* avoid collision with vprintf.c */ -int -vprintf (const char *format, va_list args) -{ - return vfprintf (stdout, format, args); -} -# endif - -# if !REPLACE_VFPRINTF_POSIX /* avoid collision with vfprintf.c */ -int -vfprintf (FILE *stream, const char *format, va_list args) -#undef vfprintf -{ - CALL_WITH_SIGPIPE_EMULATION (int, vfprintf (stream, format, args), ret == EOF) -} -# endif - -int -putchar (int c) -{ - return fputc (c, stdout); -} - -int -fputc (int c, FILE *stream) -#undef fputc -{ - CALL_WITH_SIGPIPE_EMULATION (int, fputc (c, stream), ret == EOF) -} - -int -fputs (const char *string, FILE *stream) -#undef fputs -{ - CALL_WITH_SIGPIPE_EMULATION (int, fputs (string, stream), ret == EOF) -} - -int -puts (const char *string) -#undef puts -{ - FILE *stream = stdout; - CALL_WITH_SIGPIPE_EMULATION (int, puts (string), ret == EOF) -} - -size_t -fwrite (const void *ptr, size_t s, size_t n, FILE *stream) -#undef fwrite -{ - CALL_WITH_SIGPIPE_EMULATION (size_t, fwrite (ptr, s, n, stream), ret < n) -} - -# endif -#endif diff --git a/contrib/tools/m4/lib/strdup.c b/contrib/tools/m4/lib/strdup.c deleted file mode 100644 index 5826ab02af..0000000000 --- a/contrib/tools/m4/lib/strdup.c +++ /dev/null @@ -1,54 +0,0 @@ -/* Copyright (C) 1991, 1996-1998, 2002-2004, 2006-2007, 2009-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, 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 _LIBC -# include <config.h> -#endif - -/* Get specification. */ -#include <string.h> - -#include <stdlib.h> - -#undef __strdup -#ifdef _LIBC -# undef strdup -#endif - -#ifndef weak_alias -# define __strdup strdup -#endif - -/* Duplicate S, returning an identical malloc'd string. */ -char * -__strdup (const char *s) -{ - size_t len = strlen (s) + 1; - void *new = malloc (len); - - if (new == NULL) - return NULL; - - return (char *) memcpy (new, s, len); -} -#ifdef libc_hidden_def -libc_hidden_def (__strdup) -#endif -#ifdef weak_alias -weak_alias (__strdup, strdup) -#endif diff --git a/contrib/tools/m4/lib/wcrtomb.c b/contrib/tools/m4/lib/wcrtomb.c deleted file mode 100644 index c3cda35803..0000000000 --- a/contrib/tools/m4/lib/wcrtomb.c +++ /dev/null @@ -1,56 +0,0 @@ -/* Convert wide character to multibyte character. - Copyright (C) 2008-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> - -#include <errno.h> -#include <stdlib.h> - - -// wcrtomb is defined for msvs 2017 15.7 -#if _MSC_VER < 1914 -size_t -wcrtomb (char *s, wchar_t wc, mbstate_t *ps) -{ - /* This implementation of wcrtomb on top of wctomb() supports only - stateless encodings. ps must be in the initial state. */ - if (ps != NULL && !mbsinit (ps)) - { - errno = EINVAL; - return (size_t)(-1); - } - - if (s == NULL) - /* We know the NUL wide character corresponds to the NUL character. */ - return 1; - else - { - int ret = wctomb (s, wc); - - if (ret >= 0) - return ret; - else - { - errno = EILSEQ; - return (size_t)(-1); - } - } -} -#endif diff --git a/contrib/tools/m4/lib/wcwidth.c b/contrib/tools/m4/lib/wcwidth.c deleted file mode 100644 index 253fcaa656..0000000000 --- a/contrib/tools/m4/lib/wcwidth.c +++ /dev/null @@ -1,50 +0,0 @@ -/* Determine the number of screen columns needed for a character. - Copyright (C) 2006-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/>. */ - -#include <config.h> - -/* Specification. */ -#include <wchar.h> - -/* Get iswprint. */ -#include <wctype.h> - -#include "localcharset.h" -#include "streq.h" -#include "uniwidth.h" - -int -wcwidth (wchar_t wc) -#undef wcwidth -{ - /* In UTF-8 locales, use a Unicode aware width function. */ - const char *encoding = locale_charset (); - if (STREQ_OPT (encoding, "UTF-8", 'U', 'T', 'F', '-', '8', 0, 0, 0 ,0)) - { - /* We assume that in a UTF-8 locale, a wide character is the same as a - Unicode character. */ - return uc_width (wc, encoding); - } - else - { - /* Otherwise, fall back to the system's wcwidth function. */ -#if HAVE_WCWIDTH - return wcwidth (wc); -#else - return wc == 0 ? 0 : iswprint (wc) ? 1 : -1; -#endif - } -} diff --git a/contrib/tools/m4/lib/xconcat-filename.c b/contrib/tools/m4/lib/xconcat-filename.c deleted file mode 100644 index eb2f8a9fb1..0000000000 --- a/contrib/tools/m4/lib/xconcat-filename.c +++ /dev/null @@ -1,41 +0,0 @@ -/* Construct a full filename from a directory and a relative filename. - Copyright (C) 2001-2004, 2006-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 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 <haible@clisp.cons.org>. */ - -#include <config.h> - -/* Specification. */ -#include "concat-filename.h" - -#include "xalloc.h" - -/* Concatenate a directory filename, a relative filename and an optional - suffix. The directory may end with the directory separator. The second - argument may not start with the directory separator (it is relative). - Return a freshly allocated filename. */ -char * -xconcatenated_filename (const char *directory, const char *filename, - const char *suffix) -{ - char *result; - - result = concatenated_filename (directory, filename, suffix); - if (result == NULL) - xalloc_die (); - - return result; -} diff --git a/contrib/tools/m4/lib/ya.make b/contrib/tools/m4/lib/ya.make index 3b63acf0b2..e1b2df91ca 100644 --- a/contrib/tools/m4/lib/ya.make +++ b/contrib/tools/m4/lib/ya.make @@ -79,7 +79,6 @@ SRCS( fflush.c filenamecat-lgpl.c filenamecat.c - float.c fopen-safer.c fpurge.c freading.c @@ -97,7 +96,6 @@ SRCS( isnand.c isnanl.c isnanf.c - itold.c localcharset.c lseek.c malloca.c @@ -114,7 +112,6 @@ SRCS( progname.c quotearg.c raise.c - rawmemchr.c realloc.c regex.c rmdir.c @@ -126,7 +123,6 @@ SRCS( spawn-pipe.c stat.c stpcpy.c - strdup.c stripslash.c tempname.c tmpdir.c @@ -140,7 +136,6 @@ SRCS( wctype-h.c xalloc-die.c xasprintf.c - xconcat-filename.c xmalloc.c xmalloca.c xprintf.c @@ -161,21 +156,12 @@ IF (NOT OS_LINUX) ) ENDIF() -IF (NOT OS_WINDOWS) - SRCS( - stdio-write.c - ) -ENDIF() - IF (OS_WINDOWS) SRCS( - wcrtomb.c - mkstemp.c vasprintf.c strsignal.c mkdtemp.c fseeko.c - fopen.c gettimeofday.c localeconv.c msvc-inval.c @@ -184,7 +170,6 @@ IF (OS_WINDOWS) sigaction.c sigprocmask.c waitpid.c - wcwidth.c uniwidth/width.c ) ENDIF() |