Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPekka Seppänen <pexu@sourceware.mail.kapsi.fi>2023-08-30 12:16:26 +0300
committerSebastian Huber <sebastian.huber@embedded-brains.de>2023-09-11 10:23:05 +0300
commit766f1beb4de3d75f3b6d25dcc9b41dc8b4a002e9 (patch)
tree23cfc740f4770f385f291db642624f19ae8be52d /newlib/libc/stdlib
parentf5e37b93a02508e79fbeceaa7b45b1febd44b233 (diff)
Reentrancy, use _REENT_ERRNO()
Use _REENT_ERRNO() macro to access errno. This encapsulation is required, as errno might be either _errno member of struct _reent, _tls_errno or any such implementation detail.
Diffstat (limited to 'newlib/libc/stdlib')
-rw-r--r--newlib/libc/stdlib/_mallocr.c2
-rw-r--r--newlib/libc/stdlib/nano-mallocr.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/newlib/libc/stdlib/_mallocr.c b/newlib/libc/stdlib/_mallocr.c
index 1997b6db1..c73982c18 100644
--- a/newlib/libc/stdlib/_mallocr.c
+++ b/newlib/libc/stdlib/_mallocr.c
@@ -346,7 +346,7 @@ extern void __malloc_unlock();
#define RDECL struct _reent *reent_ptr;
#endif
-#define RERRNO reent_ptr->_errno
+#define RERRNO _REENT_ERRNO(reent_ptr)
#define RCALL reent_ptr,
#define RONECALL reent_ptr
diff --git a/newlib/libc/stdlib/nano-mallocr.c b/newlib/libc/stdlib/nano-mallocr.c
index 41e69abb0..030be44ad 100644
--- a/newlib/libc/stdlib/nano-mallocr.c
+++ b/newlib/libc/stdlib/nano-mallocr.c
@@ -64,7 +64,7 @@
#define MALLOC_LOCK __malloc_lock(reent_ptr)
#define MALLOC_UNLOCK __malloc_unlock(reent_ptr)
-#define RERRNO reent_ptr->_errno
+#define RERRNO _REENT_ERRNO(reent_ptr)
#define nano_malloc _malloc_r
#define nano_free _free_r