This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fwd: [1.7] Remove the overhead of calling function _jp2uc


2009/5/15 Christopher Faylor <cgf-use-the-mailinglist-please@cygwin.com>:
> You need to send this to the newlib mailing list.

2009/5/16 Corinna Vinschen <corinna-cygwin@cygwin.com>:
> And please add a ChangeLog entry in cleartext (not as part of the

Thanks for your advices.

> From: IWAMURO Motonori <deenheart@gmail.com>
> Date: 2009/5/15
> Subject: [1.7] Remove the overhead of calling function _jp2uc
> To: cygwin-developers@cygwin.com
>
> Hi.
>
> I propose to remove the overhead of calling function _jp2uc.


	* libc/ctype/jp2uc.c: Skip all definition if defined __CYGWIN__.
	(__jp2uc): Change the scope to static function.
	* libc/ctype/local.h (_jp2uc): Define as macro if defined __CYGWIN__.
	* libc/string/local.h (_jp2uc): Define as macro if defined __CYGWIN__.


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/>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]