From f3b8138239d3ba34c4ecaa4305b0fbd7eb4e28a5 Mon Sep 17 00:00:00 2001 From: Matt Joyce 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/vsniprintf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'newlib/libc/stdio/vsniprintf.c') diff --git a/newlib/libc/stdio/vsniprintf.c b/newlib/libc/stdio/vsniprintf.c index a8b272e..e7625ff 100644 --- a/newlib/libc/stdio/vsniprintf.c +++ b/newlib/libc/stdio/vsniprintf.c @@ -54,7 +54,7 @@ _vsniprintf_r (struct _reent *ptr, if (size > INT_MAX) { - ptr->_errno = EOVERFLOW; + _REENT_ERRNO(ptr) = EOVERFLOW; return EOF; } f._flags = __SWR | __SSTR; @@ -63,7 +63,7 @@ _vsniprintf_r (struct _reent *ptr, f._file = -1; /* No file. */ ret = _svfiprintf_r (ptr, &f, fmt, ap); if (ret < EOF) - ptr->_errno = EOVERFLOW; + _REENT_ERRNO(ptr) = EOVERFLOW; if (size > 0) *f._p = 0; return ret; -- cgit v1.1