bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

use mbrtowc replacement


From: Bruno Haible
Subject: use mbrtowc replacement
Date: Mon, 22 Dec 2008 12:12:19 +0100
User-agent: KMail/1.9.9

Hi,

Now, here is a patch to make use of the mbrtowc emulation on platforms that
lack it (essentially HP-UX 11.00, IRIX 6.5, Solaris 2.6).

It causes an increase of code size on these platforms. But this is actually
a bug fix: gnulib code was assuming that is !HAVE_MBRTOWC, there are only
unibyte locales. Which is wrong for HP-UX and Solaris (each has locales with
UTF-8, EUC-JP, EUC-KR, GB2312, BIG5, EUC-TW encodings) and IRIX 6.5 (has
locales with EUC-JP, EUC-KR, GB2312, EUC-TW encodings).


2008-12-22  Bruno Haible  <address@hidden>

        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.

--- lib/mbscasecmp.c.orig       2008-12-22 11:50:43.000000000 +0100
+++ lib/mbscasecmp.c    2008-12-22 01:55:09.000000000 +0100
@@ -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 <address@hidden>, 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 @@
   /* 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 @@
       return 0;
     }
   else
-#endif
     {
       const unsigned char *p1 = (const unsigned char *) s1;
       const unsigned char *p2 = (const unsigned char *) s2;
--- lib/mbscasestr.c.orig       2008-12-22 11:50:43.000000000 +0100
+++ lib/mbscasestr.c    2008-12-22 01:55:09.000000000 +0100
@@ -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 @@
   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 @@
        - 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 @@
        return (char *) haystack;
     }
   else
-#endif
     {
       if (*needle != '\0')
        {
--- lib/mbschr.c.orig   2008-12-22 11:50:43.000000000 +0100
+++ lib/mbschr.c        2008-12-22 01:55:09.000000000 +0100
@@ -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 <address@hidden>, 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 @@
       return NULL;
     }
   else
-#endif
     return strchr (string, c);
 }
--- lib/mbscspn.c.orig  2008-12-22 11:50:43.000000000 +0100
+++ lib/mbscspn.c       2008-12-22 01:55:09.000000000 +0100
@@ -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 <address@hidden>, 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 @@
       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 @@
       return mbui_cur_ptr (iter) - string;
     }
   else
-#endif
     return strcspn (string, accept);
 }
--- lib/mbslen.c.orig   2008-12-22 11:50:43.000000000 +0100
+++ lib/mbslen.c        2008-12-22 01:55:09.000000000 +0100
@@ -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 <address@hidden>, 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 @@
       return count;
     }
   else
-#endif
     return strlen (string);
 }
--- lib/mbsncasecmp.c.orig      2008-12-22 11:50:43.000000000 +0100
+++ lib/mbsncasecmp.c   2008-12-22 01:55:09.000000000 +0100
@@ -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 <address@hidden>, 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 @@
   /* 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 @@
       return 0;
     }
   else
-#endif
     {
       const unsigned char *p1 = (const unsigned char *) s1;
       const unsigned char *p2 = (const unsigned char *) s2;
--- lib/mbsnlen.c.orig  2008-12-22 11:50:43.000000000 +0100
+++ lib/mbsnlen.c       2008-12-22 01:55:09.000000000 +0100
@@ -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 <address@hidden>, 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 @@
       return count;
     }
   else
-#endif
     return len;
 }
--- lib/mbspbrk.c.orig  2008-12-22 11:50:44.000000000 +0100
+++ lib/mbspbrk.c       2008-12-22 01:55:09.000000000 +0100
@@ -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 <address@hidden>, 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 @@
   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 @@
       return NULL;
     }
   else
-#endif
     return strpbrk (string, accept);
 }
--- lib/mbspcasecmp.c.orig      2008-12-22 11:50:44.000000000 +0100
+++ lib/mbspcasecmp.c   2008-12-22 01:55:09.000000000 +0100
@@ -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 <address@hidden>, 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 @@
   /* 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 @@
        return NULL;
     }
   else
-#endif
     {
       const unsigned char *p1 = (const unsigned char *) string;
       const unsigned char *p2 = (const unsigned char *) prefix;
--- lib/mbsrchr.c.orig  2008-12-22 11:50:44.000000000 +0100
+++ lib/mbsrchr.c       2008-12-22 01:55:09.000000000 +0100
@@ -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 <address@hidden>, 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 @@
       return (char *) result;
     }
   else
-#endif
     return strrchr (string, c);
 }
--- lib/mbssep.c.orig   2008-12-22 11:50:44.000000000 +0100
+++ lib/mbssep.c        2008-12-22 01:55:09.000000000 +0100
@@ -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 <address@hidden>, 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 @@
        }
     }
   else
-#endif
     return strsep (stringp, delim);
 }
--- lib/mbsspn.c.orig   2008-12-22 11:50:44.000000000 +0100
+++ lib/mbsspn.c        2008-12-22 01:55:09.000000000 +0100
@@ -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 <address@hidden>, 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 @@
     {
       unsigned char uc = (unsigned char) reject[0];
 
-#if HAVE_MBRTOWC
       if (MB_CUR_MAX > 1)
        {
          mbui_iterator_t iter;
@@ -50,7 +47,6 @@
          return mbui_cur_ptr (iter) - string;
        }
       else
-#endif
        {
          const char *ptr;
 
@@ -61,7 +57,6 @@
        }
     }
   /* General case.  */
-#if HAVE_MBRTOWC
   if (MB_CUR_MAX > 1)
     {
       mbui_iterator_t iter;
@@ -90,6 +85,5 @@
       return mbui_cur_ptr (iter) - string;
     }
   else
-#endif
     return strspn (string, reject);
 }
--- lib/mbsstr.c.orig   2008-12-22 11:50:44.000000000 +0100
+++ lib/mbsstr.c        2008-12-22 01:55:09.000000000 +0100
@@ -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 @@
   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 @@
        - 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 @@
        return (char *) haystack;
     }
   else
-#endif
     {
       if (*needle != '\0')
        {
--- lib/mbstok_r.c.orig 2008-12-22 11:50:44.000000000 +0100
+++ lib/mbstok_r.c      2008-12-22 01:55:09.000000000 +0100
@@ -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 <address@hidden>, 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 @@
       return string;
     }
   else
-#endif
     return strtok_r (string, delim, save_ptr);
 }
--- lib/mbswidth.c.orig 2008-12-22 11:50:44.000000000 +0100
+++ lib/mbswidth.c      2008-12-22 01:55:09.000000000 +0100
@@ -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 @@
   int width;
 
   width = 0;
-#if HAVE_MBRTOWC
   if (MB_CUR_MAX > 1)
     {
       while (p < plimit)
@@ -158,7 +151,6 @@
          }
       return width;
     }
-#endif
 
   while (p < plimit)
     {
--- modules/mbswidth.orig       2008-12-22 11:50:44.000000000 +0100
+++ modules/mbswidth    2008-12-22 01:55:09.000000000 +0100
@@ -11,6 +11,8 @@
 Depends-on:
 wchar
 wctype
+mbrtowc
+mbsinit
 wcwidth
 extensions
 
--- lib/propername.c.orig       2008-12-22 11:50:44.000000000 +0100
+++ lib/propername.c    2008-12-22 01:55:09.000000000 +0100
@@ -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 @@
        break;
       else
        {
-#if HAVE_MBRTOWC
          if (MB_CUR_MAX > 1)
            {
              mbui_iterator_t string_iter;
@@ -117,7 +114,6 @@
              string = tsub_in_string + mb_len (mbui_cur (string_iter));
            }
          else
-#endif /* HAVE_MBRTOWC */
            {
              bool word_boundary_before;
              const char *p;
--- lib/quotearg.c.orig 2008-12-22 11:50:44.000000000 +0100
+++ lib/quotearg.c      2008-12-22 01:55:09.000000000 +0100
@@ -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
--- modules/quotearg.orig       2008-12-22 11:50:44.000000000 +0100
+++ modules/quotearg    2008-12-22 01:55:09.000000000 +0100
@@ -11,6 +11,8 @@
 Depends-on:
 extensions
 gettext-h
+mbrtowc
+mbsinit
 memcmp
 stdbool
 wchar
--- lib/trim.c.orig     2008-12-22 11:50:44.000000000 +0100
+++ lib/trim.c  2008-12-22 01:55:09.000000000 +0100
@@ -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 @@
   if (!d)
     xalloc_die();
 
-#if HAVE_MBRTOWC
   if (MB_CUR_MAX > 1)
     {
       mbi_iterator_t i;
@@ -114,7 +110,6 @@
        }
     }
   else
-#endif /* HAVE_MBRTOWC */
     {
       char *p;
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]