This is the mail archive of the cygwin-cvs@cygwin.com mailing list for the Cygwin 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]

[newlib-cygwin] Drop sys_cp_wcstombs and save two arguments per call


https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=ac39f7b4e819b8200cda8be56c82964a6e18f909

commit ac39f7b4e819b8200cda8be56c82964a6e18f909
Author: Corinna Vinschen <corinna@vinschen.de>
Date:   Fri Dec 18 12:42:40 2015 +0100

    Drop sys_cp_wcstombs and save two arguments per call
    
            * strfuncs.cc (sys_cp_wcstombs): Delete and move functionality into
            sys_wcstombs.
            * wchar.h (sys_cp_wcstombs): Drop declaration.
            * fhandler_console.cc (dev_console::con_to_str): Call sys_wcstombs.
    
    Signed-off-by: Corinna Vinschen <corinna@vinschen.de>

Diff:
---
 winsup/cygwin/ChangeLog           |  7 +++++++
 winsup/cygwin/fhandler_console.cc |  3 +--
 winsup/cygwin/strfuncs.cc         | 14 ++++----------
 winsup/cygwin/wchar.h             |  2 --
 4 files changed, 12 insertions(+), 14 deletions(-)

diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 74b6db1..3dad5bc 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,10 @@
+2015-12-18  Corinna Vinschen  <corinna@vinschen.de>
+
+	* strfuncs.cc (sys_cp_wcstombs): Delete and move functionality into
+	sys_wcstombs.
+	* wchar.h (sys_cp_wcstombs): Drop declaration.
+	* fhandler_console.cc (dev_console::con_to_str): Call sys_wcstombs.
+
 2015-12-16  Corinna Vinschen  <corinna@vinschen.de>
 
 	* grp.cc (pwdgrp::parse_group): Only copy the SID if it's valid.
diff --git a/winsup/cygwin/fhandler_console.cc b/winsup/cygwin/fhandler_console.cc
index 44ee1c4..a52449e 100644
--- a/winsup/cygwin/fhandler_console.cc
+++ b/winsup/cygwin/fhandler_console.cc
@@ -218,8 +218,7 @@ tty_list::get_cttyp ()
 inline DWORD
 dev_console::con_to_str (char *d, int dlen, WCHAR w)
 {
-  return sys_cp_wcstombs (cygheap->locale.wctomb, cygheap->locale.charset,
-			  d, dlen, &w, 1);
+  return sys_wcstombs (d, dlen, &w, 1);
 }
 
 inline UINT
diff --git a/winsup/cygwin/strfuncs.cc b/winsup/cygwin/strfuncs.cc
index 0be0f53..e73cd63 100644
--- a/winsup/cygwin/strfuncs.cc
+++ b/winsup/cygwin/strfuncs.cc
@@ -59,7 +59,7 @@ static const WCHAR tfx_chars[] = {
  0xf000 | '|',          '}',          '~',          127
 };
 
-/* This is the table for the reverse functionality in sys_cp_wcstombs.
+/* This is the table for the reverse functionality in sys_wcstombs.
    It differs deliberately in two code places (space and dot) to allow
    converting back space and dot on filesystems only supporting DOS
    filenames. */
@@ -410,8 +410,7 @@ __big5_mbtowc (struct _reent *r, wchar_t *pwc, const char *s, size_t n,
        function should be raised.
 */
 size_t __reg3
-sys_cp_wcstombs (wctomb_p f_wctomb, const char *charset, char *dst, size_t len,
-		 const wchar_t *src, size_t nwc)
+sys_wcstombs (char *dst, size_t len, const wchar_t *src, size_t nwc)
 {
   char buf[10];
   char *ptr = dst;
@@ -419,6 +418,8 @@ sys_cp_wcstombs (wctomb_p f_wctomb, const char *charset, char *dst, size_t len,
   size_t n = 0;
   mbstate_t ps;
   save_errno save;
+  wctomb_p f_wctomb = cygheap->locale.wctomb;
+  const char *charset = cygheap->locale.charset;
 
   memset (&ps, 0, sizeof ps);
   if (dst == NULL)
@@ -495,13 +496,6 @@ sys_cp_wcstombs (wctomb_p f_wctomb, const char *charset, char *dst, size_t len,
   return n;
 }
 
-size_t __reg3
-sys_wcstombs (char *dst, size_t len, const wchar_t * src, size_t nwc)
-{
-  return sys_cp_wcstombs (cygheap->locale.wctomb, cygheap->locale.charset,
-			  dst, len, src, nwc);
-}
-
 /* Allocate a buffer big enough for the string, always including the
    terminating '\0'.  The buffer pointer is returned in *dst_p, the return
    value is the number of bytes written to the buffer, as usual.
diff --git a/winsup/cygwin/wchar.h b/winsup/cygwin/wchar.h
index 548ad0f..0abece2 100644
--- a/winsup/cygwin/wchar.h
+++ b/winsup/cygwin/wchar.h
@@ -50,8 +50,6 @@ extern char *__locale_charset ();
 
 #ifdef __INSIDE_CYGWIN__
 #ifdef __cplusplus
-size_t __reg3 sys_cp_wcstombs (wctomb_p, const char *, char *, size_t,
-				  const wchar_t *, size_t = (size_t) -1);
 size_t __reg3 sys_wcstombs (char *dst, size_t len, const wchar_t * src,
 			       size_t nwc = (size_t) -1);
 size_t __reg3 sys_wcstombs_alloc (char **, int, const wchar_t *,


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