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] errno: Stop using _impure_ptr->_errno completely


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

commit 44b1746a41921533d27aca414a9188314cb725b6
Author: Corinna Vinschen <corinna@vinschen.de>
Date:   Fri Mar 10 20:21:09 2017 +0100

    errno: Stop using _impure_ptr->_errno completely
    
    We use errno AKA _REENT->_errno since the last century and only set
    _impure_ptr->_errno for backward compat.  Stop that.  Also, remove
    the last check for _impure_ptr->_errno in Cygwin code.
    
    Signed-off-by: Corinna Vinschen <corinna@vinschen.de>

Diff:
---
 winsup/cygwin/cygerrno.h | 4 ++--
 winsup/cygwin/environ.cc | 3 +--
 winsup/cygwin/errno.cc   | 4 ++--
 3 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/winsup/cygwin/cygerrno.h b/winsup/cygwin/cygerrno.h
index ce33d97..05de6ab 100644
--- a/winsup/cygwin/cygerrno.h
+++ b/winsup/cygwin/cygerrno.h
@@ -30,7 +30,7 @@ extern inline int
 __set_errno (const char *fn, int ln, int val)
 {
   debug_printf ("%s:%d setting errno %d", fn, ln, val);
-  return errno = _impure_ptr->_errno = val;
+  return errno = val;
 }
 #define set_errno(val) __set_errno (__PRETTY_FUNCTION__, __LINE__, (val))
 
@@ -45,7 +45,7 @@ class save_errno
     save_errno (int what) {saved = get_errno (); set_errno (what); }
     void set (int what) {set_errno (what); saved = what;}
     void reset () {saved = get_errno ();}
-    ~save_errno () {errno = _impure_ptr->_errno = saved;}
+    ~save_errno () {errno = saved;}
   };
 
 extern const char *__sp_fn;
diff --git a/winsup/cygwin/environ.cc b/winsup/cygwin/environ.cc
index 667e7c0..7d90e4f 100644
--- a/winsup/cygwin/environ.cc
+++ b/winsup/cygwin/environ.cc
@@ -454,8 +454,7 @@ posify_maybe (char **here, const char *value, char *outenv)
 
   memcpy (outenv, src, len);
   char *newvalue = outenv + len;
-  if (!conv->toposix (value, newvalue, NT_MAX_PATH - len)
-      || _impure_ptr->_errno != EIDRM)
+  if (!conv->toposix (value, newvalue, NT_MAX_PATH - len) || errno != EIDRM)
     conv->add_cache (newvalue, *value != '/' ? value : NULL);
   else
     {
diff --git a/winsup/cygwin/errno.cc b/winsup/cygwin/errno.cc
index 9168e9b..390723e 100644
--- a/winsup/cygwin/errno.cc
+++ b/winsup/cygwin/errno.cc
@@ -339,7 +339,7 @@ void __reg3
 seterrno_from_win_error (const char *file, int line, DWORD code)
 {
   syscall_printf ("%s:%d windows error %u", file, line, code);
-  errno = _impure_ptr->_errno =  geterrno_from_win_error (code, EACCES);
+  errno = geterrno_from_win_error (code, EACCES);
 }
 
 int __reg2
@@ -357,7 +357,7 @@ seterrno_from_nt_status (const char *file, int line, NTSTATUS status)
   SetLastError (code);
   syscall_printf ("%s:%d status %y -> windows error %u",
 		  file, line, status, code);
-  errno = _impure_ptr->_errno =  geterrno_from_win_error (code, EACCES);
+  errno = geterrno_from_win_error (code, EACCES);
 }
 
 static char *


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