[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: * tp/Texinfo/XS/xspara.c: Remove include directiv
From: |
Gavin D. Smith |
Subject: |
branch master updated: * tp/Texinfo/XS/xspara.c: Remove include directives for several header files that we don't need any more due to using libunistring functions instead of locale-dependent libc functions. [_WIN32] (w32_setlocale, mbrlen, mbrtowc, iswspace, iswupper): Remove these now-unused implementations. |
Date: |
Sat, 18 Nov 2023 15:24:57 -0500 |
This is an automated email from the git hooks/post-receive script.
gavin pushed a commit to branch master
in repository texinfo.
The following commit(s) were added to refs/heads/master by this push:
new 2b6df351e9 * tp/Texinfo/XS/xspara.c: Remove include directives for
several header files that we don't need any more due to using libunistring
functions instead of locale-dependent libc functions. [_WIN32] (w32_setlocale,
mbrlen, mbrtowc, iswspace, iswupper): Remove these now-unused implementations.
2b6df351e9 is described below
commit 2b6df351e9adb155084ae0ac9915b06d5a5efbba
Author: Gavin Smith <gavinsmith0123@gmail.com>
AuthorDate: Sat Nov 18 20:24:49 2023 +0000
* tp/Texinfo/XS/xspara.c: Remove include directives for several
header files that we don't need any more due to using libunistring
functions instead of locale-dependent libc functions.
[_WIN32] (w32_setlocale, mbrlen, mbrtowc, iswspace, iswupper):
Remove these now-unused implementations.
---
ChangeLog | 8 ++++
tp/Texinfo/XS/xspara.c | 126 -------------------------------------------------
2 files changed, 8 insertions(+), 126 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 82b90d9636..c84ee59c91 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2023-11-18 Gavin Smith <gavinsmith0123@gmail.com>
+
+ * tp/Texinfo/XS/xspara.c: Remove include directives for several
+ header files that we don't need any more due to using libunistring
+ functions instead of locale-dependent libc functions.
+ [_WIN32] (w32_setlocale, mbrlen, mbrtowc, iswspace, iswupper):
+ Remove these now-unused implementations.
+
2023-11-18 Gavin Smith <gavinsmith0123@gmail.com>
* tp/texi2any.supp: Add suppression for memory leak with
diff --git a/tp/Texinfo/XS/xspara.c b/tp/Texinfo/XS/xspara.c
index faadc0c826..e458aa4eae 100644
--- a/tp/Texinfo/XS/xspara.c
+++ b/tp/Texinfo/XS/xspara.c
@@ -19,16 +19,6 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#include <locale.h>
-#ifndef _WIN32
-#include <langinfo.h>
-#else /* _WIN32 */
-/* Workaround for problems caused in mingw.org's MinGW build by
- Gnulib's wchar.h overriding the wint_t type definition, which
- causes compilation errors when perl.h is included below, because
- perl.h includes ctype.h. */
-#include <ctype.h>
-#endif
#include <unitypes.h>
#include <uniwidth.h>
@@ -116,122 +106,6 @@ static PARAGRAPH state;
#ifdef _WIN32
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-#include <errno.h>
-
-/* If Gnulib overrides wint_t with a wider type, we cannot use
- iswspace etc. names, whose prototypes were seen with the original
- wint_t in effect. */
-#ifdef GNULIB_defined_wint_t
-# undef iswspace
-# define iswspace(w) w32_iswspace(w)
-# undef iswupper
-# define iswupper(w) w32_iswupper(w)
-#endif
-
-char *
-w32_setlocale (int category, const char *value)
-{
- if (_stricmp (value, "en_us.utf-8") != 0)
- return NULL;
-
- /* Switch to the Windows U.S. English locale with its default
- codeset. We will handle the non-ASCII text ourselves, so the
- codeset is unimportant, and Windows doesn't support UTF-8 as the
- codeset anyway. */
- return setlocale (category, "ENU");
-}
-#define setlocale(c,v) w32_setlocale(c,v)
-
-size_t
-mbrlen (const char * __restrict__ mbs, size_t n, mbstate_t * __restrict__ ps)
-{
- unsigned char byte1 = *mbs;
-
- if (ps != NULL)
- {
- errno = ENOSYS;
- return -1;
- }
-
- return
- ((byte1 & 0x80) == 0) ? 1 : ((byte1 & 0x20) == 0) ? 2 :
- ((byte1 & 0x10) == 0) ? 3 : 4;
-}
-
-/* Convert a UTF-8 encoded multibyte string to a wide character. */
-size_t
-mbrtowc (wchar_t * __restrict__ pwc, const char * __restrict__ mbs, size_t n,
- mbstate_t * __restrict__ ps)
-{
- int len = mbrlen (mbs, n, ps);
-
- if (mbs == NULL)
- return 0;
- else
- {
- wchar_t wc[2];
- size_t n_utf16 = MultiByteToWideChar (CP_UTF8, MB_ERR_INVALID_CHARS,
- mbs, len, wc, 2);
- if (n_utf16 == 0)
- {
- errno = EILSEQ;
- return (size_t)-1;
- }
- if (ps != NULL)
- {
- errno = ENOSYS;
- return (size_t)-1;
- }
- /* We don't support UTF-16 surrogates, because the calling code
- doesn't, and because character classification functions on
- Windows don't support anything beyond the BMP anyway. So we
- return the first character of the surrogate pair and set
- errno. */
- if (n_utf16 > 1)
- errno = ENOSYS;
- if (pwc != NULL)
- *pwc = wc[0];
-
- return len;
- }
-}
-
-/* NOTE - not used at present */
-int
-iswspace (wint_t wc)
-{
- /* See Unicode's Proplist.txt. */
- if ((wc >= 0x09 && wc <= 0x0D)
- || wc == 0x20
- || wc == 0x85
- || wc == 0xA0
- || wc == 0x1680
- || (wc >= 0x2000 && wc <= 0x200A)
- || wc == 0x2028
- || wc == 0x2029
- || wc == 0x202F
- || wc == 0x205F
- || wc == 0x3000)
- return 1;
-
- return 0;
-}
-
-int
-iswupper (wint_t wi)
-{
- WORD char_type;
- wchar_t wc = wi;
- BOOL status = GetStringTypeW (CT_CTYPE1, &wc, 1, &char_type);
-
- if (!status || (char_type & C1_UPPER) == 0)
- return 0;
-
- return 1;
-}
-
/* Avoid warnings due to redefinition of popen/pclose in Perl headers. */
#ifdef popen
# undef popen
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: * tp/Texinfo/XS/xspara.c: Remove include directives for several header files that we don't need any more due to using libunistring functions instead of locale-dependent libc functions. [_WIN32] (w32_setlocale, mbrlen, mbrtowc, iswspace, iswupper): Remove these now-unused implementations.,
Gavin D. Smith <=