am 4e47988f: Merge "Remove macros putc*/getc* from API<21 stdio.h to use"
* commit '4e47988faed03f8ab525cc91f82213c2c9d59120': Remove macros putc*/getc* from API<21 stdio.h to use
This commit is contained in:
@@ -354,39 +354,10 @@ __END_DECLS
|
||||
#define fwopen(cookie, fn) funopen(cookie, 0, fn, 0, 0)
|
||||
#endif /* __BSD_VISIBLE */
|
||||
|
||||
/*
|
||||
* Functions internal to the implementation.
|
||||
*/
|
||||
__BEGIN_DECLS
|
||||
int __srget(FILE *);
|
||||
int __swbuf(int, FILE *);
|
||||
__END_DECLS
|
||||
|
||||
/*
|
||||
* The __sfoo macros are here so that we can
|
||||
* define function versions in the C library.
|
||||
*/
|
||||
#define __sgetc(p) (--(p)->_r < 0 ? __srget(p) : (int)(*(p)->_p++))
|
||||
#if defined(__GNUC__)
|
||||
static __inline int __sputc(int _c, FILE *_p) {
|
||||
if (--_p->_w >= 0 || (_p->_w >= _p->_lbfsize && (char)_c != '\n'))
|
||||
return (*_p->_p++ = _c);
|
||||
else
|
||||
return (__swbuf(_c, _p));
|
||||
}
|
||||
#else
|
||||
/*
|
||||
* This has been tuned to generate reasonable code on the vax using pcc.
|
||||
*/
|
||||
#define __sputc(c, p) \
|
||||
(--(p)->_w < 0 ? \
|
||||
(p)->_w >= (p)->_lbfsize ? \
|
||||
(*(p)->_p = (c)), *(p)->_p != '\n' ? \
|
||||
(int)*(p)->_p++ : \
|
||||
__swbuf('\n', p) : \
|
||||
__swbuf((int)(c), p) : \
|
||||
(*(p)->_p = (c), (int)*(p)->_p++))
|
||||
#endif
|
||||
|
||||
#define __sfeof(p) (((p)->_flags & __SEOF) != 0)
|
||||
#define __sferror(p) (((p)->_flags & __SERR) != 0)
|
||||
@@ -404,23 +375,6 @@ static __inline int __sputc(int _c, FILE *_p) {
|
||||
#define fileno(p) __sfileno(p)
|
||||
#endif
|
||||
|
||||
#ifndef lint
|
||||
#ifndef _POSIX_THREADS
|
||||
#define getc(fp) __sgetc(fp)
|
||||
#endif /* _POSIX_THREADS */
|
||||
#define getc_unlocked(fp) __sgetc(fp)
|
||||
/*
|
||||
* The macro implementations of putc and putc_unlocked are not
|
||||
* fully POSIX compliant; they do not set errno on failure
|
||||
*/
|
||||
#if __BSD_VISIBLE
|
||||
#ifndef _POSIX_THREADS
|
||||
#define putc(x, fp) __sputc(x, fp)
|
||||
#endif /* _POSIX_THREADS */
|
||||
#define putc_unlocked(x, fp) __sputc(x, fp)
|
||||
#endif /* __BSD_VISIBLE */
|
||||
#endif /* lint */
|
||||
|
||||
#define getchar() getc(stdin)
|
||||
#define putchar(x) putc(x, stdout)
|
||||
#define getchar_unlocked() getc_unlocked(stdin)
|
||||
|
||||
@@ -354,39 +354,10 @@ __END_DECLS
|
||||
#define fwopen(cookie, fn) funopen(cookie, 0, fn, 0, 0)
|
||||
#endif /* __BSD_VISIBLE */
|
||||
|
||||
/*
|
||||
* Functions internal to the implementation.
|
||||
*/
|
||||
__BEGIN_DECLS
|
||||
int __srget(FILE *);
|
||||
int __swbuf(int, FILE *);
|
||||
__END_DECLS
|
||||
|
||||
/*
|
||||
* The __sfoo macros are here so that we can
|
||||
* define function versions in the C library.
|
||||
*/
|
||||
#define __sgetc(p) (--(p)->_r < 0 ? __srget(p) : (int)(*(p)->_p++))
|
||||
#if defined(__GNUC__)
|
||||
static __inline int __sputc(int _c, FILE *_p) {
|
||||
if (--_p->_w >= 0 || (_p->_w >= _p->_lbfsize && (char)_c != '\n'))
|
||||
return (*_p->_p++ = _c);
|
||||
else
|
||||
return (__swbuf(_c, _p));
|
||||
}
|
||||
#else
|
||||
/*
|
||||
* This has been tuned to generate reasonable code on the vax using pcc.
|
||||
*/
|
||||
#define __sputc(c, p) \
|
||||
(--(p)->_w < 0 ? \
|
||||
(p)->_w >= (p)->_lbfsize ? \
|
||||
(*(p)->_p = (c)), *(p)->_p != '\n' ? \
|
||||
(int)*(p)->_p++ : \
|
||||
__swbuf('\n', p) : \
|
||||
__swbuf((int)(c), p) : \
|
||||
(*(p)->_p = (c), (int)*(p)->_p++))
|
||||
#endif
|
||||
|
||||
#define __sfeof(p) (((p)->_flags & __SEOF) != 0)
|
||||
#define __sferror(p) (((p)->_flags & __SERR) != 0)
|
||||
@@ -404,23 +375,6 @@ static __inline int __sputc(int _c, FILE *_p) {
|
||||
#define fileno(p) __sfileno(p)
|
||||
#endif
|
||||
|
||||
#ifndef lint
|
||||
#ifndef _POSIX_THREADS
|
||||
#define getc(fp) __sgetc(fp)
|
||||
#endif /* _POSIX_THREADS */
|
||||
#define getc_unlocked(fp) __sgetc(fp)
|
||||
/*
|
||||
* The macro implementations of putc and putc_unlocked are not
|
||||
* fully POSIX compliant; they do not set errno on failure
|
||||
*/
|
||||
#if __BSD_VISIBLE
|
||||
#ifndef _POSIX_THREADS
|
||||
#define putc(x, fp) __sputc(x, fp)
|
||||
#endif /* _POSIX_THREADS */
|
||||
#define putc_unlocked(x, fp) __sputc(x, fp)
|
||||
#endif /* __BSD_VISIBLE */
|
||||
#endif /* lint */
|
||||
|
||||
#define getchar() getc(stdin)
|
||||
#define putchar(x) putc(x, stdout)
|
||||
#define getchar_unlocked() getc_unlocked(stdin)
|
||||
|
||||
Reference in New Issue
Block a user