This is the mail archive of the
cygwin-developers
mailing list for the Cygwin project.
[1.7] Remove the overhead of calling function _jp2uc
- From: IWAMURO Motonori <deenheart at gmail dot com>
- To: cygwin-developers at cygwin dot com
- Date: Fri, 15 May 2009 22:57:31 +0900
- Subject: [1.7] Remove the overhead of calling function _jp2uc
Hi.
I propose to remove the overhead of calling function _jp2uc.
Index: newlib/libc/ctype/jp2uc.c
===================================================================
RCS file: /cvs/src/src/newlib/libc/ctype/jp2uc.c,v
retrieving revision 1.5
diff -u -p -r1.5 jp2uc.c
--- newlib/libc/ctype/jp2uc.c 14 May 2009 20:16:21 -0000 1.5
+++ newlib/libc/ctype/jp2uc.c 15 May 2009 13:54:36 -0000
@@ -32,6 +32,9 @@
#include <newlib.h>
#ifdef _MB_CAPABLE
+/* Under Cygwin, the incoming wide character is already given in UTF due
+ to the requirements of the underlying OS. */
+#ifndef __CYGWIN__
#include <_ansi.h>
#include <wctype.h>
@@ -43,7 +46,7 @@
#define JP_SJIS 2
#define JP_EUCJP 3
-wint_t
+static wint_t
_DEFUN (__jp2uc, (c, type), wint_t c _AND int type)
{
int index, adj;
@@ -150,17 +153,14 @@ _DEFUN (__jp2uc, (c, type), wint_t c _AN
wint_t
_DEFUN (_jp2uc, (c), wint_t c)
{
-/* Under Cygwin, the incoming wide character is already given in UTF due
- to the requirements of the underlying OS. */
-#ifndef __CYGWIN__
if (!strcmp (__locale_charset (), "JIS"))
c = __jp2uc (c, JP_JIS);
else if (!strcmp (__locale_charset (), "SJIS"))
c = __jp2uc (c, JP_SJIS);
else if (!strcmp (__locale_charset (), "EUCJP"))
c = __jp2uc (c, JP_EUCJP);
-#endif
return c;
}
+#endif /* !__CYGWIN__ */
#endif /* _MB_CAPABLE */
Index: newlib/libc/ctype/local.h
===================================================================
RCS file: /cvs/src/src/newlib/libc/ctype/local.h,v
retrieving revision 1.3
diff -u -p -r1.3 local.h
--- newlib/libc/ctype/local.h 14 May 2009 20:16:21 -0000 1.3
+++ newlib/libc/ctype/local.h 15 May 2009 13:54:36 -0000
@@ -23,5 +23,10 @@
extern char *__locale_charset ();
/* internal function to translate JP to Unicode */
+#ifdef __CYGWIN__
+/* Under Cygwin, the incoming wide character is already given in UTF due
+ to the requirements of the underlying OS. */
+#define _jp2uc(c) (c)
+#else
wint_t _EXFUN (_jp2uc, (wint_t));
-
+#endif
Index: newlib/libc/string/local.h
===================================================================
RCS file: /cvs/src/src/newlib/libc/string/local.h,v
retrieving revision 1.1
diff -u -p -r1.1 local.h
--- newlib/libc/string/local.h 15 May 2009 11:40:28 -0000 1.1
+++ newlib/libc/string/local.h 15 May 2009 13:54:37 -0000
@@ -1,7 +1,13 @@
#include <_ansi.h>
/* internal function to translate JP to Unicode */
+#ifdef __CYGWIN__
+/* Under Cygwin, the incoming wide character is already given in UTF due
+ to the requirements of the underlying OS. */
+#define _jp2uc(c) (c)
+#else
wint_t _EXFUN (_jp2uc, (wint_t));
+#endif
/* internal function to compute width of wide char. */
int _EXFUN (__wcwidth, (wint_t));
--
IWAMURO Motnori <http://vmi.jp/>