[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: strftime updates
From: |
Bruno Haible |
Subject: |
Re: strftime updates |
Date: |
Sun, 18 Jan 2009 22:11:22 +0100 |
User-agent: |
KMail/1.9.9 |
Hi Jim,
> > Also, the test for mempcpy is redundant since nothing uses it. Proposed
> > patch:
>
> That looks fine, and you're welcome to apply it.
Applied.
How about the other small cleanups that I mentioned in
<http://lists.gnu.org/archive/html/bug-gnulib/2009-01/msg00012.html>?
Here is a proposed patch. The comment in glibc ("The GNU C Library uses UTF8
multibyte encoding") is actually wrong, since glibc supports locales in
BIG5, GB18030, etc. - like other platforms.
2009-01-18 Bruno Haible <address@hidden>
* m4/strftime.m4 (gl_FUNC_STRFTIME): Don't test for mblen and mbrlen.
* lib/strftime.c (HAVE_MBLEN, HAVE_MBRLEN): Remove macros.
(MULTIBYTE_IS_FORMAT_SAFE): Define to 1 on all platforms except OSF/1.
--- m4/strftime.m4.orig 2009-01-18 22:08:32.000000000 +0100
+++ m4/strftime.m4 2009-01-18 22:08:29.000000000 +0100
@@ -1,4 +1,4 @@
-# serial 31
+# serial 32
# Copyright (C) 1996, 1997, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
# 2006, 2007, 2009 Free Software Foundation, Inc.
@@ -25,7 +25,7 @@
AC_REQUIRE([AC_TYPE_MBSTATE_T])
AC_REQUIRE([gl_TM_GMTOFF])
- AC_CHECK_FUNCS_ONCE([mblen mbrlen tzset])
+ AC_CHECK_FUNCS_ONCE([tzset])
AC_CHECK_HEADERS_ONCE([wchar.h])
AC_DEFINE([my_strftime], [nstrftime],
--- lib/strftime.c.orig 2009-01-18 22:08:32.000000000 +0100
+++ lib/strftime.c 2009-01-18 22:06:00.000000000 +0100
@@ -18,14 +18,11 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#ifdef _LIBC
-# define HAVE_MBLEN 1
-# define HAVE_MBRLEN 1
# define HAVE_STRUCT_ERA_ENTRY 1
# define HAVE_TM_GMTOFF 1
# define HAVE_TM_ZONE 1
# define HAVE_TZNAME 1
# define HAVE_TZSET 1
-# define MULTIBYTE_IS_FORMAT_SAFE 1
# include "../locale/localeinfo.h"
#else
# include <config.h>
@@ -44,10 +41,16 @@
/* Do multibyte processing if multibytes are supported, unless
multibyte sequences are safe in formats. Multibyte sequences are
safe if they cannot contain byte sequences that look like format
- conversion specifications. The GNU C Library uses UTF8 multibyte
- encoding, which is safe for formats, but strftime.c can be used
- with other C libraries that use unsafe encodings. */
-#define DO_MULTIBYTE (HAVE_MBLEN && ! MULTIBYTE_IS_FORMAT_SAFE)
+ conversion specifications. The multibyte encodings used by the
+ C library on the various platforms (UTF-8, GB2312, GBK, CP936,
+ GB18030, EUC-TW, BIG5, BIG5-HKSCS, CP950, EUC-JP, EUC-KR, CP949,
+ SHIFT_JIS, CP932, JOHAB) are safe for formats, because the byte '%'
+ cannot occur in a multibyte character except in the first byte.
+ But this does not hold for the DEC-HANYU encoding used on OSF/1. */
+#if !defined __osf__
+# define MULTIBYTE_IS_FORMAT_SAFE 1
+#endif
+#define DO_MULTIBYTE (! MULTIBYTE_IS_FORMAT_SAFE)
#if DO_MULTIBYTE
# include <wchar.h>
Message not available