summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog42
-rw-r--r--lib/mbscasecmp.c8
-rw-r--r--lib/mbscasestr.c8
-rw-r--r--lib/mbschr.c8
-rw-r--r--lib/mbscspn.c8
-rw-r--r--lib/mbslen.c8
-rw-r--r--lib/mbsncasecmp.c8
-rw-r--r--lib/mbsnlen.c8
-rw-r--r--lib/mbspbrk.c8
-rw-r--r--lib/mbspcasecmp.c8
-rw-r--r--lib/mbsrchr.c8
-rw-r--r--lib/mbssep.c8
-rw-r--r--lib/mbsspn.c10
-rw-r--r--lib/mbsstr.c8
-rw-r--r--lib/mbstok_r.c8
-rw-r--r--lib/mbswidth.c10
-rw-r--r--lib/propername.c6
-rw-r--r--lib/quotearg.c17
-rw-r--r--lib/trim.c13
-rw-r--r--modules/mbswidth2
-rw-r--r--modules/quotearg2
21 files changed, 78 insertions, 128 deletions
diff --git a/ChangeLog b/ChangeLog
index 3be5159ee4..798c04ef25 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,47 @@
2008-12-22 Bruno Haible <bruno@clisp.org>
+ Remove HAVE_MBRTOWC conditionals.
+ * lib/mbscasecmp.c: Include mbuiter.h unconditionally.
+ (mbscasecmp): Assume mbrtowc function.
+ * lib/mbscasestr.c: Include mbuiter.h unconditionally.
+ (knuth_morris_pratt_multibyte, mbscasestr): Assume mbrtowc function.
+ * lib/mbschr.c: Include mbuiter.h unconditionally.
+ (mbschr): Assume mbrtowc function.
+ * lib/mbscspn.c: Include mbuiter.h unconditionally.
+ (mbscspn): Assume mbrtowc function.
+ * lib/mbslen.c: Include mbuiter.h unconditionally.
+ (mbslen): Assume mbrtowc function.
+ * lib/mbsncasecmp.c: Include mbuiter.h unconditionally.
+ (mbsncasecmp): Assume mbrtowc function.
+ * lib/mbsnlen.c: Include mbiter.h unconditionally.
+ (mbsnlen): Assume mbrtowc function.
+ * lib/mbspbrk.c: Include mbuiter.h unconditionally.
+ (mbspbrk): Assume mbrtowc function.
+ * lib/mbspcasecmp.c: Include mbuiter.h unconditionally.
+ (mbspcasecmp): Assume mbrtowc function.
+ * lib/mbsrchr.c: Include mbuiter.h unconditionally.
+ (mbsrchr): Assume mbrtowc function.
+ * lib/mbssep.c: Include mbuiter.h unconditionally.
+ (mbssep): Assume mbrtowc function.
+ * lib/mbsspn.c: Include mbuiter.h unconditionally.
+ (mbsspn): Assume mbrtowc function.
+ * lib/mbsstr.c: Include mbuiter.h unconditionally.
+ (knuth_morris_pratt_multibyte, mbsstr): Assume mbrtowc function.
+ * lib/mbstok_r.c: Include mbuiter.h unconditionally.
+ (mbstok_r): Assume mbrtowc function.
+ * lib/propername.c: Include mbuiter.h unconditionally.
+ (mbsstr_trimmed_wordbounded): Assume mbrtowc function.
+ * lib/trim.c: Include mbchar.h, mbiter.h uncondtionally.
+ (trim2): Assume mbrtowc function.
+ * lib/mbswidth.c (mbsinit): Remove fallback definition.
+ (mbsnwidth): Assume mbrtowc function.
+ * modules/mbswidth (Depends-on): Add mbrtowc, mbsinit.
+ * lib/quotearg.c (MB_CUR_MAX, mbstate_t, mbrtowc, iswprint): Remove
+ fallback definitions.
+ * modules/quotearg (Depends-on): Add mbrtowc, mbsinit.
+
+2008-12-22 Bruno Haible <bruno@clisp.org>
+
* doc/posix-functions/mbtowc.texi: Mention a glibc bug.
2008-12-22 Paolo Bonzini <bonzini@gnu.org>
diff --git a/lib/mbscasecmp.c b/lib/mbscasecmp.c
index 19f974b33f..7fdfdeb3d6 100644
--- a/lib/mbscasecmp.c
+++ b/lib/mbscasecmp.c
@@ -1,5 +1,5 @@
/* Case-insensitive string comparison function.
- Copyright (C) 1998-1999, 2005-2007 Free Software Foundation, Inc.
+ Copyright (C) 1998-1999, 2005-2008 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2005,
based on earlier glibc code.
@@ -24,9 +24,7 @@
#include <ctype.h>
#include <limits.h>
-#if HAVE_MBRTOWC
-# include "mbuiter.h"
-#endif
+#include "mbuiter.h"
#define TOLOWER(Ch) (isupper (Ch) ? tolower (Ch) : (Ch))
@@ -44,7 +42,6 @@ mbscasecmp (const char *s1, const char *s2)
/* Be careful not to look at the entire extent of s1 or s2 until needed.
This is useful because when two strings differ, the difference is
most often already in the very few first characters. */
-#if HAVE_MBRTOWC
if (MB_CUR_MAX > 1)
{
mbui_iterator_t iter1;
@@ -72,7 +69,6 @@ mbscasecmp (const char *s1, const char *s2)
return 0;
}
else
-#endif
{
const unsigned char *p1 = (const unsigned char *) s1;
const unsigned char *p2 = (const unsigned char *) s2;
diff --git a/lib/mbscasestr.c b/lib/mbscasestr.c
index a136b21d8c..7a3466356b 100644
--- a/lib/mbscasestr.c
+++ b/lib/mbscasestr.c
@@ -25,9 +25,7 @@
#include <stddef.h> /* for NULL, in case a nonstandard string.h lacks it */
#include "malloca.h"
-#if HAVE_MBRTOWC
-# include "mbuiter.h"
-#endif
+#include "mbuiter.h"
#define TOLOWER(Ch) (isupper (Ch) ? tolower (Ch) : (Ch))
@@ -35,7 +33,6 @@
#define CANON_ELEMENT(c) TOLOWER (c)
#include "str-kmp.h"
-#if HAVE_MBRTOWC
/* Knuth-Morris-Pratt algorithm.
See http://en.wikipedia.org/wiki/Knuth-Morris-Pratt_algorithm
Return a boolean indicating success:
@@ -192,7 +189,6 @@ knuth_morris_pratt_multibyte (const char *haystack, const char *needle,
freea (memory);
return true;
}
-#endif
/* Find the first occurrence of the character string NEEDLE in the character
string HAYSTACK, using case-insensitive comparison.
@@ -206,7 +202,6 @@ mbscasestr (const char *haystack, const char *needle)
- haystack may be very long, and a match of needle found early,
- needle may be very long, and not even a short initial segment of
needle may be found in haystack. */
-#if HAVE_MBRTOWC
if (MB_CUR_MAX > 1)
{
mbui_iterator_t iter_needle;
@@ -319,7 +314,6 @@ mbscasestr (const char *haystack, const char *needle)
return (char *) haystack;
}
else
-#endif
{
if (*needle != '\0')
{
diff --git a/lib/mbschr.c b/lib/mbschr.c
index 5997b18cfd..ec1ebac053 100644
--- a/lib/mbschr.c
+++ b/lib/mbschr.c
@@ -1,5 +1,5 @@
/* Searching a string for a character.
- Copyright (C) 2007 Free Software Foundation, Inc.
+ Copyright (C) 2007-2008 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2007.
This program is free software: you can redistribute it and/or modify
@@ -20,16 +20,13 @@
/* Specification. */
#include <string.h>
-#if HAVE_MBRTOWC
-# include "mbuiter.h"
-#endif
+#include "mbuiter.h"
/* Locate the first single-byte character C in the character string STRING,
and return a pointer to it. Return NULL if C is not found in STRING. */
char *
mbschr (const char *string, int c)
{
-#if HAVE_MBRTOWC
if (MB_CUR_MAX > 1
/* Optimization: We know that ASCII characters < 0x30 don't occur as
part of multibyte characters longer than 1 byte. Hence, if c < 0x30,
@@ -51,6 +48,5 @@ mbschr (const char *string, int c)
return NULL;
}
else
-#endif
return strchr (string, c);
}
diff --git a/lib/mbscspn.c b/lib/mbscspn.c
index e0818e19d4..6d3fe674b0 100644
--- a/lib/mbscspn.c
+++ b/lib/mbscspn.c
@@ -1,5 +1,5 @@
/* Searching a string for a character among a given set of characters.
- Copyright (C) 1999, 2002, 2006-2007 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2006-2008 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2007.
This program is free software: you can redistribute it and/or modify
@@ -20,9 +20,7 @@
/* Specification. */
#include <string.h>
-#if HAVE_MBRTOWC
-# include "mbuiter.h"
-#endif
+#include "mbuiter.h"
/* Find the first occurrence in the character string STRING of any character
in the character string ACCEPT. Return the number of bytes from the
@@ -40,7 +38,6 @@ mbscspn (const char *string, const char *accept)
return (ptr != NULL ? ptr - string : strlen (string));
}
/* General case. */
-#if HAVE_MBRTOWC
if (MB_CUR_MAX > 1)
{
mbui_iterator_t iter;
@@ -67,6 +64,5 @@ mbscspn (const char *string, const char *accept)
return mbui_cur_ptr (iter) - string;
}
else
-#endif
return strcspn (string, accept);
}
diff --git a/lib/mbslen.c b/lib/mbslen.c
index cb5ac5b46d..2dd6ea8bb6 100644
--- a/lib/mbslen.c
+++ b/lib/mbslen.c
@@ -1,5 +1,5 @@
/* Counting the multibyte characters in a string.
- Copyright (C) 2007 Free Software Foundation, Inc.
+ Copyright (C) 2007-2008 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2007.
This program is free software: you can redistribute it and/or modify
@@ -22,15 +22,12 @@
#include <stdlib.h>
-#if HAVE_MBRTOWC
-# include "mbuiter.h"
-#endif
+#include "mbuiter.h"
/* Return the number of multibyte characters in the character string STRING. */
size_t
mbslen (const char *string)
{
-#if HAVE_MBRTOWC
if (MB_CUR_MAX > 1)
{
size_t count;
@@ -43,6 +40,5 @@ mbslen (const char *string)
return count;
}
else
-#endif
return strlen (string);
}
diff --git a/lib/mbsncasecmp.c b/lib/mbsncasecmp.c
index 3763d9616f..4c8c5a55c9 100644
--- a/lib/mbsncasecmp.c
+++ b/lib/mbsncasecmp.c
@@ -1,5 +1,5 @@
/* Case-insensitive string comparison function.
- Copyright (C) 1998-1999, 2005-2007 Free Software Foundation, Inc.
+ Copyright (C) 1998-1999, 2005-2008 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2005,
based on earlier glibc code.
@@ -24,9 +24,7 @@
#include <ctype.h>
#include <limits.h>
-#if HAVE_MBRTOWC
-# include "mbuiter.h"
-#endif
+#include "mbuiter.h"
#define TOLOWER(Ch) (isupper (Ch) ? tolower (Ch) : (Ch))
@@ -46,7 +44,6 @@ mbsncasecmp (const char *s1, const char *s2, size_t n)
/* Be careful not to look at the entire extent of s1 or s2 until needed.
This is useful because when two strings differ, the difference is
most often already in the very few first characters. */
-#if HAVE_MBRTOWC
if (MB_CUR_MAX > 1)
{
mbui_iterator_t iter1;
@@ -77,7 +74,6 @@ mbsncasecmp (const char *s1, const char *s2, size_t n)
return 0;
}
else
-#endif
{
const unsigned char *p1 = (const unsigned char *) s1;
const unsigned char *p2 = (const unsigned char *) s2;
diff --git a/lib/mbsnlen.c b/lib/mbsnlen.c
index fe4e39e6c1..78c751f35b 100644
--- a/lib/mbsnlen.c
+++ b/lib/mbsnlen.c
@@ -1,5 +1,5 @@
/* Counting the multibyte characters in a string.
- Copyright (C) 2007 Free Software Foundation, Inc.
+ Copyright (C) 2007-2008 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2007.
This program is free software: you can redistribute it and/or modify
@@ -22,16 +22,13 @@
#include <stdlib.h>
-#if HAVE_MBRTOWC
-# include "mbiter.h"
-#endif
+#include "mbiter.h"
/* Return the number of multibyte characters in the character string starting
at STRING and ending at STRING + LEN. */
size_t
mbsnlen (const char *string, size_t len)
{
-#if HAVE_MBRTOWC
if (MB_CUR_MAX > 1)
{
size_t count;
@@ -44,6 +41,5 @@ mbsnlen (const char *string, size_t len)
return count;
}
else
-#endif
return len;
}
diff --git a/lib/mbspbrk.c b/lib/mbspbrk.c
index 363958d8dd..bf56d5a1e0 100644
--- a/lib/mbspbrk.c
+++ b/lib/mbspbrk.c
@@ -1,5 +1,5 @@
/* Searching a string for a character among a given set of characters.
- Copyright (C) 1999, 2002, 2006-2007 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2006-2008 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2007.
This program is free software: you can redistribute it and/or modify
@@ -20,9 +20,7 @@
/* Specification. */
#include <string.h>
-#if HAVE_MBRTOWC
-# include "mbuiter.h"
-#endif
+#include "mbuiter.h"
/* Find the first occurrence in the character string STRING of any character
in the character string ACCEPT. Return the pointer to it, or NULL if none
@@ -36,7 +34,6 @@ mbspbrk (const char *string, const char *accept)
if (accept[1] == '\0')
return mbschr (string, accept[0]);
/* General case. */
-#if HAVE_MBRTOWC
if (MB_CUR_MAX > 1)
{
mbui_iterator_t iter;
@@ -62,6 +59,5 @@ mbspbrk (const char *string, const char *accept)
return NULL;
}
else
-#endif
return strpbrk (string, accept);
}
diff --git a/lib/mbspcasecmp.c b/lib/mbspcasecmp.c
index 7340cafb6b..7cde9b76e7 100644
--- a/lib/mbspcasecmp.c
+++ b/lib/mbspcasecmp.c
@@ -1,5 +1,5 @@
/* Case-insensitive string comparison function.
- Copyright (C) 1998-1999, 2005-2007 Free Software Foundation, Inc.
+ Copyright (C) 1998-1999, 2005-2008 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2007.
This program is free software: you can redistribute it and/or modify
@@ -22,9 +22,7 @@
#include <ctype.h>
-#if HAVE_MBRTOWC
-# include "mbuiter.h"
-#endif
+#include "mbuiter.h"
#define TOLOWER(Ch) (isupper (Ch) ? tolower (Ch) : (Ch))
@@ -47,7 +45,6 @@ mbspcasecmp (const char *string, const char *prefix)
/* Be careful not to look at the entire extent of STRING or PREFIX until
needed. This is useful because when two strings differ, the difference is
most often already in the very few first characters. */
-#if HAVE_MBRTOWC
if (MB_CUR_MAX > 1)
{
mbui_iterator_t iter1;
@@ -74,7 +71,6 @@ mbspcasecmp (const char *string, const char *prefix)
return NULL;
}
else
-#endif
{
const unsigned char *p1 = (const unsigned char *) string;
const unsigned char *p2 = (const unsigned char *) prefix;
diff --git a/lib/mbsrchr.c b/lib/mbsrchr.c
index 679f9a48f4..087904dec1 100644
--- a/lib/mbsrchr.c
+++ b/lib/mbsrchr.c
@@ -1,5 +1,5 @@
/* Searching a string for the last occurrence of a character.
- Copyright (C) 2007 Free Software Foundation, Inc.
+ Copyright (C) 2007-2008 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2007.
This program is free software: you can redistribute it and/or modify
@@ -20,16 +20,13 @@
/* Specification. */
#include <string.h>
-#if HAVE_MBRTOWC
-# include "mbuiter.h"
-#endif
+#include "mbuiter.h"
/* Locate the last single-byte character C in the character string STRING,
and return a pointer to it. Return NULL if C is not found in STRING. */
char *
mbsrchr (const char *string, int c)
{
-#if HAVE_MBRTOWC
if (MB_CUR_MAX > 1
/* Optimization: We know that ASCII characters < 0x30 don't occur as
part of multibyte characters longer than 1 byte. Hence, if c < 0x30,
@@ -48,6 +45,5 @@ mbsrchr (const char *string, int c)
return (char *) result;
}
else
-#endif
return strrchr (string, c);
}
diff --git a/lib/mbssep.c b/lib/mbssep.c
index a19f68fa91..3a9b530eed 100644
--- a/lib/mbssep.c
+++ b/lib/mbssep.c
@@ -1,5 +1,5 @@
/* Tokenizing a string.
- Copyright (C) 2007 Free Software Foundation, Inc.
+ Copyright (C) 2007-2008 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2007.
This program is free software: you can redistribute it and/or modify
@@ -20,14 +20,11 @@
/* Specification. */
#include <string.h>
-#if HAVE_MBRTOWC
-# include "mbuiter.h"
-#endif
+#include "mbuiter.h"
char *
mbssep (char **stringp, const char *delim)
{
-#if HAVE_MBRTOWC
if (MB_CUR_MAX > 1)
{
char *start = *stringp;
@@ -60,6 +57,5 @@ mbssep (char **stringp, const char *delim)
}
}
else
-#endif
return strsep (stringp, delim);
}
diff --git a/lib/mbsspn.c b/lib/mbsspn.c
index 8f399b0434..3ef41ca1b3 100644
--- a/lib/mbsspn.c
+++ b/lib/mbsspn.c
@@ -1,5 +1,5 @@
/* Searching a string for a character outside a given set of characters.
- Copyright (C) 1999, 2002, 2006-2007 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2006-2008 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2007.
This program is free software: you can redistribute it and/or modify
@@ -20,9 +20,7 @@
/* Specification. */
#include <string.h>
-#if HAVE_MBRTOWC
-# include "mbuiter.h"
-#endif
+#include "mbuiter.h"
/* Find the first occurrence in the character string STRING of any character
not in the character string REJECT. Return the number of bytes from the
@@ -38,7 +36,6 @@ mbsspn (const char *string, const char *reject)
{
unsigned char uc = (unsigned char) reject[0];
-#if HAVE_MBRTOWC
if (MB_CUR_MAX > 1)
{
mbui_iterator_t iter;
@@ -50,7 +47,6 @@ mbsspn (const char *string, const char *reject)
return mbui_cur_ptr (iter) - string;
}
else
-#endif
{
const char *ptr;
@@ -61,7 +57,6 @@ mbsspn (const char *string, const char *reject)
}
}
/* General case. */
-#if HAVE_MBRTOWC
if (MB_CUR_MAX > 1)
{
mbui_iterator_t iter;
@@ -90,6 +85,5 @@ mbsspn (const char *string, const char *reject)
return mbui_cur_ptr (iter) - string;
}
else
-#endif
return strspn (string, reject);
}
diff --git a/lib/mbsstr.c b/lib/mbsstr.c
index 35fd02b544..c84946b630 100644
--- a/lib/mbsstr.c
+++ b/lib/mbsstr.c
@@ -24,15 +24,12 @@
#include <stddef.h> /* for NULL, in case a nonstandard string.h lacks it */
#include "malloca.h"
-#if HAVE_MBRTOWC
-# include "mbuiter.h"
-#endif
+#include "mbuiter.h"
/* Knuth-Morris-Pratt algorithm. */
#define CANON_ELEMENT(c) c
#include "str-kmp.h"
-#if HAVE_MBRTOWC
/* Knuth-Morris-Pratt algorithm.
See http://en.wikipedia.org/wiki/Knuth-Morris-Pratt_algorithm
Return a boolean indicating success:
@@ -178,7 +175,6 @@ knuth_morris_pratt_multibyte (const char *haystack, const char *needle,
freea (memory);
return true;
}
-#endif
/* Find the first occurrence of the character string NEEDLE in the character
string HAYSTACK. Return NULL if NEEDLE is not found in HAYSTACK. */
@@ -190,7 +186,6 @@ mbsstr (const char *haystack, const char *needle)
- haystack may be very long, and a match of needle found early,
- needle may be very long, and not even a short initial segment of
needle may be found in haystack. */
-#if HAVE_MBRTOWC
if (MB_CUR_MAX > 1)
{
mbui_iterator_t iter_needle;
@@ -291,7 +286,6 @@ mbsstr (const char *haystack, const char *needle)
return (char *) haystack;
}
else
-#endif
{
if (*needle != '\0')
{
diff --git a/lib/mbstok_r.c b/lib/mbstok_r.c
index 06fdc8d8fc..b698d3fad2 100644
--- a/lib/mbstok_r.c
+++ b/lib/mbstok_r.c
@@ -1,5 +1,5 @@
/* Tokenizing a string.
- Copyright (C) 1999, 2002, 2006-2007 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2006-2008 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2007.
This program is free software: you can redistribute it and/or modify
@@ -20,14 +20,11 @@
/* Specification. */
#include <string.h>
-#if HAVE_MBRTOWC
-# include "mbuiter.h"
-#endif
+#include "mbuiter.h"
char *
mbstok_r (char *string, const char *delim, char **save_ptr)
{
-#if HAVE_MBRTOWC
if (MB_CUR_MAX > 1)
{
if (string == NULL)
@@ -65,6 +62,5 @@ mbstok_r (char *string, const char *delim, char **save_ptr)
return string;
}
else
-#endif
return strtok_r (string, delim, save_ptr);
}
diff --git a/lib/mbswidth.c b/lib/mbswidth.c
index 3c54133a99..0f380a9dcc 100644
--- a/lib/mbswidth.c
+++ b/lib/mbswidth.c
@@ -1,5 +1,5 @@
/* Determine the number of screen columns needed for a string.
- Copyright (C) 2000-2007 Free Software Foundation, Inc.
+ Copyright (C) 2000-2008 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
@@ -35,12 +35,6 @@
/* Get iswcntrl(). */
#include <wctype.h>
-#ifndef mbsinit
-# if !HAVE_MBSINIT
-# define mbsinit(ps) 1
-# endif
-#endif
-
/* Returns the number of columns needed to represent the multibyte
character string pointed to by STRING. If a non-printable character
occurs, and MBSW_REJECT_UNPRINTABLE is specified, -1 is returned.
@@ -66,7 +60,6 @@ mbsnwidth (const char *string, size_t nbytes, int flags)
int width;
width = 0;
-#if HAVE_MBRTOWC
if (MB_CUR_MAX > 1)
{
while (p < plimit)
@@ -158,7 +151,6 @@ mbsnwidth (const char *string, size_t nbytes, int flags)
}
return width;
}
-#endif
while (p < plimit)
{
diff --git a/lib/propername.c b/lib/propername.c
index 5cd4d8f49a..b3c91aee16 100644
--- a/lib/propername.c
+++ b/lib/propername.c
@@ -31,9 +31,7 @@
#include "trim.h"
#include "mbchar.h"
-#if HAVE_MBRTOWC
-# include "mbuiter.h"
-#endif
+#include "mbuiter.h"
#include "localcharset.h"
#include "c-strcase.h"
#include "xstriconv.h"
@@ -60,7 +58,6 @@ mbsstr_trimmed_wordbounded (const char *string, const char *sub)
break;
else
{
-#if HAVE_MBRTOWC
if (MB_CUR_MAX > 1)
{
mbui_iterator_t string_iter;
@@ -117,7 +114,6 @@ mbsstr_trimmed_wordbounded (const char *string, const char *sub)
string = tsub_in_string + mb_len (mbui_cur (string_iter));
}
else
-#endif /* HAVE_MBRTOWC */
{
bool word_boundary_before;
const char *p;
diff --git a/lib/quotearg.c b/lib/quotearg.c
index 75fbc72f3d..339bf34942 100644
--- a/lib/quotearg.c
+++ b/lib/quotearg.c
@@ -37,23 +37,6 @@
#define _(msgid) gettext (msgid)
#define N_(msgid) msgid
-#if !HAVE_MBRTOWC
-/* Disable multibyte processing entirely. Since MB_CUR_MAX is 1, the
- other macros are defined only for documentation and to satisfy C
- syntax. */
-# undef MB_CUR_MAX
-# define MB_CUR_MAX 1
-# undef mbstate_t
-# define mbstate_t int
-# define mbrtowc(pwc, s, n, ps) ((*(pwc) = *(s)) != 0)
-# define iswprint(wc) isprint ((unsigned char) (wc))
-# undef HAVE_MBSINIT
-#endif
-
-#if !defined mbsinit && !HAVE_MBSINIT
-# define mbsinit(ps) 1
-#endif
-
#ifndef SIZE_MAX
# define SIZE_MAX ((size_t) -1)
#endif
diff --git a/lib/trim.c b/lib/trim.c
index 9293a64cec..452d8bc740 100644
--- a/lib/trim.c
+++ b/lib/trim.c
@@ -23,14 +23,11 @@
#include <ctype.h>
#include <string.h>
+#include <stddef.h>
+#include <stdlib.h>
-#if HAVE_MBRTOWC
-# include <stddef.h>
-# include <stdlib.h>
-# include "mbchar.h"
-# include "mbiter.h"
-#endif
-
+#include "mbchar.h"
+#include "mbiter.h"
#include "xalloc.h"
/* Use this to suppress gcc's `...may be used before initialized' warnings. */
@@ -50,7 +47,6 @@ trim2(const char *s, int how)
if (!d)
xalloc_die();
-#if HAVE_MBRTOWC
if (MB_CUR_MAX > 1)
{
mbi_iterator_t i;
@@ -114,7 +110,6 @@ trim2(const char *s, int how)
}
}
else
-#endif /* HAVE_MBRTOWC */
{
char *p;
diff --git a/modules/mbswidth b/modules/mbswidth
index 6094ef664b..330748dfe0 100644
--- a/modules/mbswidth
+++ b/modules/mbswidth
@@ -11,6 +11,8 @@ m4/mbswidth.m4
Depends-on:
wchar
wctype
+mbrtowc
+mbsinit
wcwidth
extensions
diff --git a/modules/quotearg b/modules/quotearg
index 9a2245fb65..59ecea3556 100644
--- a/modules/quotearg
+++ b/modules/quotearg
@@ -11,6 +11,8 @@ m4/quotearg.m4
Depends-on:
extensions
gettext-h
+mbrtowc
+mbsinit
memcmp
stdbool
wchar