diff options
Diffstat (limited to 'usr/src')
-rw-r--r-- | usr/src/head/stdio.h | 13 | ||||
-rw-r--r-- | usr/src/lib/libc/inc/mtlib.h | 6 | ||||
-rw-r--r-- | usr/src/lib/libc/inc/stdiom.h | 12 | ||||
-rw-r--r-- | usr/src/lib/libc/port/stdio/getc.c | 16 | ||||
-rw-r--r-- | usr/src/lib/libc/port/stdio/getw.c | 6 | ||||
-rw-r--r-- | usr/src/lib/libc/port/stdio/putc.c | 24 | ||||
-rw-r--r-- | usr/src/lib/libc/port/stdio/putw.c | 6 |
7 files changed, 32 insertions, 51 deletions
diff --git a/usr/src/head/stdio.h b/usr/src/head/stdio.h index 9575bf2401..2f20e59041 100644 --- a/usr/src/head/stdio.h +++ b/usr/src/head/stdio.h @@ -362,25 +362,12 @@ extern int fseeko64(FILE *, off64_t, int); extern off64_t ftello64(FILE *); #endif -#if !defined(__lint) - #if defined(__EXTENSIONS__) || defined(_REENTRANT) || \ (_POSIX_C_SOURCE - 0 >= 199506L) -#ifndef _LP64 -#define getc_unlocked(p) (--(p)->_cnt < 0 \ - ? __filbuf(p) \ - : (int)*(p)->_ptr++) -#define putc_unlocked(x, p) (--(p)->_cnt < 0 \ - ? __flsbuf((x), (p)) \ - : (int)(*(p)->_ptr++ = \ - (unsigned char) (x))) -#endif /* _LP64 */ #define getchar_unlocked() getc_unlocked(stdin) #define putchar_unlocked(x) putc_unlocked((x), stdout) #endif /* defined(__EXTENSIONS__) || defined(_REENTRANT).. */ -#endif /* !defined(__lint) */ - #ifdef __cplusplus } #endif diff --git a/usr/src/lib/libc/inc/mtlib.h b/usr/src/lib/libc/inc/mtlib.h index aa5e9e0992..cad6c7ab8d 100644 --- a/usr/src/lib/libc/inc/mtlib.h +++ b/usr/src/lib/libc/inc/mtlib.h @@ -27,8 +27,6 @@ #ifndef _MTLIB_H #define _MTLIB_H -#pragma ident "%Z%%M% %I% %E% SMI" - #include <thread.h> #ifdef __cplusplus @@ -66,9 +64,9 @@ extern void assert_no_libc_locks_held(void); #define _FWRITE _fwrite_unlocked #define FILENO(s) _fileno(s) #define FERROR(s) ferror(s) -#define GETC(s) _getc_unlocked(s) +#define GETC(s) _getc_internal(s) #define UNGETC(c, s) _ungetc_unlocked(c, s) -#define PUTC(c, s) _putc_unlocked(c, s) +#define PUTC(c, s) _putc_internal(c, s) #define GETWC(s) getwc(s) #define PUTWC(c, s) putwc(c, s) diff --git a/usr/src/lib/libc/inc/stdiom.h b/usr/src/lib/libc/inc/stdiom.h index 9befb8a3c6..348d65b4c9 100644 --- a/usr/src/lib/libc/inc/stdiom.h +++ b/usr/src/lib/libc/inc/stdiom.h @@ -25,7 +25,7 @@ */ /* Copyright (c) 1988 AT&T */ -/* All Rights Reserved */ +/* All Rights Reserved */ /* * stdiom.h - shared guts of stdio @@ -34,8 +34,6 @@ #ifndef _STDIOM_H #define _STDIOM_H -#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.9 */ - #include <thread.h> #include <synch.h> #include <mtlib.h> @@ -152,7 +150,7 @@ extern int __flsbuf(int, FILE *); */ #define _realbufend(iop) ((iop)->_end) #else -extern Uchar *_realbufend(FILE *iop); +extern Uchar *_realbufend(FILE *iop); extern rmutex_t *_reallock(FILE *iop); #endif /* _LP64 */ @@ -206,7 +204,7 @@ extern int _fileno(FILE *iop); /* * Internal routines from _findbuf.c */ -extern Uchar *_findbuf(FILE *iop); +extern Uchar *_findbuf(FILE *iop); /* * Internal routine used by fopen.c @@ -221,12 +219,12 @@ extern size_t _fwrite_unlocked(const void *, size_t, size_t, FILE *); /* * Internal routine from getc.c */ -int _getc_unlocked(FILE *); +int _getc_internal(FILE *); /* * Internal routine from put.c */ -int _putc_unlocked(int, FILE *); +int _putc_internal(int, FILE *); /* * Internal routine from ungetc.c diff --git a/usr/src/lib/libc/port/stdio/getc.c b/usr/src/lib/libc/port/stdio/getc.c index cfcf53f347..b7a48b7f3a 100644 --- a/usr/src/lib/libc/port/stdio/getc.c +++ b/usr/src/lib/libc/port/stdio/getc.c @@ -25,9 +25,7 @@ */ /* Copyright (c) 1988 AT&T */ -/* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" +/* All Rights Reserved */ #pragma weak _getc_unlocked = getc_unlocked @@ -51,10 +49,7 @@ getc(FILE *iop) int c; FLOCKFILE(lk, iop); - - _SET_ORIENTATION_BYTE(iop); - - c = (--iop->_cnt < 0) ? __filbuf(iop) : *iop->_ptr++; + c = getc_unlocked(iop); FUNLOCKFILE(lk); return (c); } @@ -63,5 +58,12 @@ getc(FILE *iop) int getc_unlocked(FILE *iop) { + _SET_ORIENTATION_BYTE(iop); + return ((--iop->_cnt < 0) ? __filbuf(iop) : *iop->_ptr++); +} + +int +_getc_internal(FILE *iop) +{ return ((--iop->_cnt < 0) ? __filbuf(iop) : *iop->_ptr++); } diff --git a/usr/src/lib/libc/port/stdio/getw.c b/usr/src/lib/libc/port/stdio/getw.c index cca7732a00..6586d99a18 100644 --- a/usr/src/lib/libc/port/stdio/getw.c +++ b/usr/src/lib/libc/port/stdio/getw.c @@ -25,9 +25,7 @@ */ /* Copyright (c) 1988 AT&T */ -/* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" +/* All Rights Reserved */ /* * The intent here is to provide a means to make the order of @@ -57,7 +55,7 @@ getw(FILE *stream) FLOCKFILE(lk, stream); while (--i >= 0 && !(stream->_flag & (_IOERR | _IOEOF))) - *s++ = GETC(stream); + *s++ = getc_unlocked(stream); ret = ((stream->_flag & (_IOERR | _IOEOF)) ? EOF : w); FUNLOCKFILE(lk); return (ret); diff --git a/usr/src/lib/libc/port/stdio/putc.c b/usr/src/lib/libc/port/stdio/putc.c index 05383201a3..df74a0cf89 100644 --- a/usr/src/lib/libc/port/stdio/putc.c +++ b/usr/src/lib/libc/port/stdio/putc.c @@ -25,9 +25,7 @@ */ /* Copyright (c) 1988 AT&T */ -/* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" +/* All Rights Reserved */ #pragma weak _putc_unlocked = putc_unlocked @@ -51,22 +49,24 @@ putc(int ch, FILE *iop) int ret; FLOCKFILE(lk, iop); + ret = putc_unlocked(ch, iop); + FUNLOCKFILE(lk); + return (ret); +} +int +putc_unlocked(int ch, FILE *iop) +{ _SET_ORIENTATION_BYTE(iop); if (--iop->_cnt < 0) - ret = __flsbuf((unsigned char) ch, iop); - else { - (*iop->_ptr++) = (unsigned char)ch; - ret = (unsigned char)ch; - } - FUNLOCKFILE(lk); - return (ret); + return (__flsbuf((unsigned char) ch, iop)); + else + return (*iop->_ptr++ = (unsigned char)ch); } - int -putc_unlocked(int ch, FILE *iop) +_putc_internal(int ch, FILE *iop) { if (--iop->_cnt < 0) return (__flsbuf((unsigned char) ch, iop)); diff --git a/usr/src/lib/libc/port/stdio/putw.c b/usr/src/lib/libc/port/stdio/putw.c index 043125e113..70848e6a06 100644 --- a/usr/src/lib/libc/port/stdio/putw.c +++ b/usr/src/lib/libc/port/stdio/putw.c @@ -25,9 +25,7 @@ */ /* Copyright (c) 1988 AT&T */ -/* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" +/* All Rights Reserved */ /* * The intent here is to provide a means to make the order of @@ -54,7 +52,7 @@ putw(int w, FILE *stream) rmutex_t *lk; FLOCKFILE(lk, stream); - while (--i >= 0 && PUTC(*s++, stream) != EOF) + while (--i >= 0 && putc_unlocked(*s++, stream) != EOF) ; ret = stream->_flag & _IOERR; FUNLOCKFILE(lk); |