From f3b8138239d3ba34c4ecaa4305b0fbd7eb4e28a5 Mon Sep 17 00:00:00 2001
From: Matt Joyce <matthew.joyce@embedded-brains.de>
Date: Tue, 18 Jan 2022 10:13:04 +0100
Subject: Add _REENT_ERRNO(ptr)

Add a _REENT_ERRNO() macro to encapsulate the access to the
_errno member of struct reent. This will help to replace the
structure member with a thread-local storage object in a follow
up patch.

Replace uses of __errno_r() with _REENT_ERRNO().  Keep __errno_r() macro for
potential users outside of Newlib.
---
 newlib/libc/stdio/wsetup.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'newlib/libc/stdio/wsetup.c')

diff --git a/newlib/libc/stdio/wsetup.c b/newlib/libc/stdio/wsetup.c
index 6a820f1..0fd9690 100644
--- a/newlib/libc/stdio/wsetup.c
+++ b/newlib/libc/stdio/wsetup.c
@@ -45,7 +45,7 @@ __swsetup_r (struct _reent *ptr,
     {
       if ((fp->_flags & __SRW) == 0)
         {
-	  ptr->_errno = EBADF;
+	  _REENT_ERRNO(ptr) = EBADF;
 	  fp->_flags |= __SERR;
 	  return EOF;
         }
-- 
cgit v1.1