summaryrefslogtreecommitdiffstats
path: root/newlib/libc/stdio/getchar_u.c
diff options
context:
space:
mode:
Diffstat (limited to 'newlib/libc/stdio/getchar_u.c')
-rw-r--r--newlib/libc/stdio/getchar_u.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/newlib/libc/stdio/getchar_u.c b/newlib/libc/stdio/getchar_u.c
index be566ea26..ce4014519 100644
--- a/newlib/libc/stdio/getchar_u.c
+++ b/newlib/libc/stdio/getchar_u.c
@@ -21,11 +21,16 @@ FUNCTION
INDEX
getchar_unlocked
+INDEX
+ _getchar_unlocked_r
POSIX_SYNOPSIS
#include <stdio.h>
int getchar_unlocked();
+ #include <stdio.h>
+ int _getchar_unlocked_r(struct _reent *<[ptr]>);
+
DESCRIPTION
<<getchar_unlocked>> is a non-thread-safe version of <<getchar>>
declared in <<stdio.h>>. <<getchar_unlocked>> may only safely be used
@@ -36,6 +41,10 @@ the ( FILE *) object, as is the case after a successful call to the
flockfile() or ftrylockfile() functions. If threads are disabled,
then <<getchar_unlocked>> is equivalent to <<getchar>>.
+The <<_getchar_unlocked_r>> function is simply the reentrant version of
+<<getchar_unlocked>> which passes an addtional reentrancy structure pointer
+argument: <[ptr]>.
+
RETURNS
See <<getchar>>.
@@ -61,10 +70,10 @@ static char sccsid[] = "%W% (Berkeley) %G%";
#undef getchar_unlocked
int
-_DEFUN(_getchar_unlocked_r, (f),
- struct _reent *f)
+_DEFUN(_getchar_unlocked_r, (ptr),
+ struct _reent *ptr)
{
- return getc_unlocked (_stdin_r (f));
+ return _getc_unlocked_r (ptr, _stdin_r (ptr));
}
#ifndef _REENT_ONLY
@@ -72,9 +81,9 @@ _DEFUN(_getchar_unlocked_r, (f),
int
_DEFUN_VOID(getchar_unlocked)
{
- /* CHECK_INIT is called (eventually) by __srefill. */
+ /* CHECK_INIT is called (eventually) by __srefill_r. */
- return _getchar_unlocked_r (_REENT);
+ return _getc_unlocked_r (_REENT, _stdin_r (_REENT));
}
#endif