]> pd.if.org Git - pdclib.old/commitdiff
Namespace cleanliness: Rename all ***_unlocked functions to _PDCLIB_***_unlocked.
authorOwen Shepherd <owen.shepherd@e43.eu>
Wed, 20 Feb 2013 01:21:15 +0000 (01:21 +0000)
committerOwen Shepherd <owen.shepherd@e43.eu>
Wed, 20 Feb 2013 01:21:15 +0000 (01:21 +0000)
Trivial forwarders ***_unlocked -> _PDCLIB_***_unlocked will be implemented (but these functions avoid exposing the _unlocked symbols to code which is only requesting the standard-defined versions)

37 files changed:
functions/stdio/_PDCLIB_ftell64.c
functions/stdio/_PDCLIB_print.c
functions/stdio/clearerr.c
functions/stdio/feof.c
functions/stdio/ferror.c
functions/stdio/fflush.c
functions/stdio/fgetc.c
functions/stdio/fgetpos.c
functions/stdio/fgets.c
functions/stdio/flockfile.c
functions/stdio/fprintf.c
functions/stdio/fputc.c
functions/stdio/fputs.c
functions/stdio/fread.c
functions/stdio/freopen.c
functions/stdio/fscanf.c
functions/stdio/fseek.c
functions/stdio/fsetpos.c
functions/stdio/ftell.c
functions/stdio/ftrylockfile.c
functions/stdio/funlockfile.c
functions/stdio/fwrite.c
functions/stdio/getc.c
functions/stdio/getchar.c
functions/stdio/printf.c
functions/stdio/putc.c
functions/stdio/putchar.c
functions/stdio/puts.c
functions/stdio/rewind.c
functions/stdio/scanf.c
functions/stdio/setvbuf.c
functions/stdio/ungetc.c
functions/stdio/vfprintf.c
functions/stdio/vfscanf.c
functions/stdio/vprintf.c
functions/stdio/vscanf.c
internals/_PDCLIB_io.h

index 5be7be50692096453aa3f9f03fe1f6a53c56b56d..f72d2f96098ccfbe311bd5c4212eb23a18c9ed2e 100644 (file)
@@ -41,9 +41,9 @@ uint_fast64_t _PDCLIB_ftell64_unlocked( FILE * stream )
 \r
 uint_fast64_t _PDCLIB_ftell64( FILE * stream )\r
 {\r
-  flockfile( stream );\r
+  _PDCLIB_flockfile( stream );\r
   uint_fast64_t pos = _PDCLIB_ftell64_unlocked( stream );\r
-  funlockfile( stream );\r
+  _PDCLIB_funlockfile( stream );\r
   return pos;\r
 }\r
 \r
index 95fbe9c752e62acd964b2f5c981e3c6e2d7d56da..ec7dc4a33b1f6914510f15af73813b7786c6d7db 100644 (file)
@@ -16,6 +16,7 @@
 #include <limits.h>
 
 #ifndef REGTEST
+#include <_PDCLIB_io.h>
 
 /* Using an integer's bits as flags for both the conversion flags and length
    modifiers.
@@ -53,7 +54,7 @@ do { \
     int character = x; \
     if ( status->i < status->n ) { \
         if ( status->stream != NULL ) \
-            putc_unlocked( character, status->stream ); \
+            _PDCLIB_putc_unlocked( character, status->stream ); \
         else \
             status->s[status->i] = character; \
     } \
index 20af80f298b4a1e792e6e8de80b5cce58f4e977a..a80e3e2987a1b727643717a5857c0cc8e48cd6d9 100644 (file)
 #ifndef REGTEST
 #include <_PDCLIB_io.h>
 
-void clearerr_unlocked( FILE * stream )
+void _PDCLIB_clearerr_unlocked( FILE * stream )
 {
     stream->status &= ~( _PDCLIB_ERRORFLAG | _PDCLIB_EOFFLAG );
 }
 
 void clearerr( FILE * stream )
 {
-    flockfile( stream );
-    clearerr_unlocked( stream );
-    funlockfile( stream );
+    _PDCLIB_flockfile( stream );
+    _PDCLIB_clearerr_unlocked( stream );
+    _PDCLIB_funlockfile( stream );
 }
 
 #endif
index b37c7b94dd0bdffbf734eaba24d4aaf9a15ed384..772bb5090f3223cb9e0d8382577657e56937c382 100644 (file)
 #ifndef REGTEST
 #include <_PDCLIB_io.h>
 
-int feof_unlocked( FILE * stream )
+int _PDCLIB_feof_unlocked( FILE * stream )
 {
     return stream->status & _PDCLIB_EOFFLAG;
 }
 
 int feof( FILE * stream )
 {
-    flockfile( stream );
-    int eof = feof_unlocked( stream );
-    funlockfile( stream );
+    _PDCLIB_flockfile( stream );
+    int eof = _PDCLIB_feof_unlocked( stream );
+    _PDCLIB_funlockfile( stream );
     return eof;
 }
 
index f683787e567975ad8cd759b58bee255a16ddc990..07ecde7228774b237f6a5fbdbaa2ec8c93e973cc 100644 (file)
 #ifndef REGTEST
 #include <_PDCLIB_io.h>
 
-int ferror_unlocked( FILE * stream )
+int _PDCLIB_ferror_unlocked( FILE * stream )
 {
     return stream->status & _PDCLIB_ERRORFLAG;
 }
 
 int ferror( FILE * stream )
 {
-    flockfile( stream );
-    int error = ferror_unlocked( stream );
-    funlockfile( stream );
+    _PDCLIB_flockfile( stream );
+    int error = _PDCLIB_ferror_unlocked( stream );
+    _PDCLIB_funlockfile( stream );
     return error;
 }
 
index e03079fcc9c17fdf661a961b77fdbec46cbbab60..3f1a4118a4d9a9ff7dc300b303e3e08badfbb4f3 100644 (file)
@@ -13,7 +13,7 @@
 
 extern FILE * _PDCLIB_filelist;
 
-int fflush_unlocked( FILE * stream )
+int _PDCLIB_fflush_unlocked( FILE * stream )
 {
     if ( stream == NULL )
     {
@@ -41,9 +41,9 @@ int fflush_unlocked( FILE * stream )
 
 int fflush( FILE * stream )
 {
-    flockfile( stream );
-    int res = fflush_unlocked(stream);
-    funlockfile( stream );
+    _PDCLIB_flockfile( stream );
+    int res = _PDCLIB_fflush_unlocked(stream);
+    _PDCLIB_funlockfile( stream );
     return res;
 }
                 
index 56e96f5eca481fbdf88136fe42ffa5c03d29dcf5..114ab975e2e9b928e7154bd04a41ca7ce2ae4697 100644 (file)
@@ -11,7 +11,7 @@
 #ifndef REGTEST
 #include <_PDCLIB_io.h>
 
-int fgetc_unlocked( FILE * stream )
+int _PDCLIB_fgetc_unlocked( FILE * stream )
 {
     if ( _PDCLIB_prepread( stream ) == EOF )
     {
@@ -27,9 +27,9 @@ int fgetc_unlocked( FILE * stream )
 
 int fgetc( FILE * stream )
 {
-    flockfile( stream );
-    int c = fgetc_unlocked( stream );
-    funlockfile( stream );
+    _PDCLIB_flockfile( stream );
+    int c = _PDCLIB_fgetc_unlocked( stream );
+    _PDCLIB_funlockfile( stream );
     return c;
 }
 
index 84014063ea18ec838130bc056a054c147417e92a..d4a717e86312a93f7ee9802e309846f33546b496 100644 (file)
@@ -11,7 +11,7 @@
 #ifndef REGTEST
 #include <_PDCLIB_io.h>
 
-int fgetpos_unlocked( FILE * _PDCLIB_restrict stream, _PDCLIB_fpos_t * _PDCLIB_restrict pos )
+int _PDCLIB_fgetpos_unlocked( FILE * _PDCLIB_restrict stream, _PDCLIB_fpos_t * _PDCLIB_restrict pos )
 {
     pos->offset = stream->pos.offset + stream->bufidx - stream->ungetidx;
     pos->mbs    = stream->pos.mbs;
@@ -21,9 +21,9 @@ int fgetpos_unlocked( FILE * _PDCLIB_restrict stream, _PDCLIB_fpos_t * _PDCLIB_r
 
 int fgetpos( FILE * _PDCLIB_restrict stream, _PDCLIB_fpos_t * _PDCLIB_restrict pos )
 {
-    flockfile( stream );
-    int res = fgetpos_unlocked( stream, pos );
-    funlockfile( stream );
+    _PDCLIB_flockfile( stream );
+    int res = _PDCLIB_fgetpos_unlocked( stream, pos );
+    _PDCLIB_funlockfile( stream );
     return res;
 }
 
index 95103bb2ad753f8d9430a1af6be9208dea4babb3..fd893443b8679a27149c3f8f65d2e47ee0bd6b92 100644 (file)
@@ -11,7 +11,7 @@
 #ifndef REGTEST
 #include <_PDCLIB_io.h>
 
-char * fgets_unlocked( char * _PDCLIB_restrict s, int size, FILE * _PDCLIB_restrict stream )
+char * _PDCLIB_fgets_unlocked( char * _PDCLIB_restrict s, int size, FILE * _PDCLIB_restrict stream )
 {
     if ( size == 0 )
     {
@@ -37,9 +37,9 @@ char * fgets_unlocked( char * _PDCLIB_restrict s, int size, FILE * _PDCLIB_restr
 char * fgets( char * _PDCLIB_restrict s, int size, 
               FILE * _PDCLIB_restrict stream )
 {
-    flockfile( stream );
-    char* r = fgets_unlocked( s, size, stream );
-    funlockfile( stream );
+    _PDCLIB_flockfile( stream );
+    char* r = _PDCLIB_fgets_unlocked( s, size, stream );
+    _PDCLIB_funlockfile( stream );
     return r;
 }
 
index 9167da097dcd116a44dc6efca497cc2e8a435a94..33b2e1440d830f8e3871064a931659a329c1727b 100644 (file)
@@ -12,7 +12,7 @@
 #include <threads.h>\r
 #include <stdlib.h>\r
 \r
-void flockfile( FILE * file )\r
+void _PDCLIB_flockfile( FILE * file )\r
 {\r
     if( mtx_lock( &file->lock ) != thrd_success ) {\r
         abort();\r
index 0227cd4d17ad520dfb99bc21160d060f0ccb93bb..66566a4d5a6fb953e57a3a15df3defacec8b2daa 100644 (file)
 #ifndef REGTEST
 #include <_PDCLIB_io.h>
 
-int fprintf_unlocked( FILE * _PDCLIB_restrict stream, 
+int _PDCLIB_fprintf_unlocked( FILE * _PDCLIB_restrict stream, 
                       const char * _PDCLIB_restrict format, ... )
 {
     int rc;
     va_list ap;
     va_start( ap, format );
-    rc = vfprintf( stream, format, ap );
+    rc = _PDCLIB_vfprintf_unlocked( stream, format, ap );
     va_end( ap );
     return rc;
 }
@@ -29,9 +29,9 @@ int fprintf( FILE * _PDCLIB_restrict stream,
     int rc;
     va_list ap;
     va_start( ap, format );
-    flockfile( stream );
-    rc = vfprintf_unlocked( stream, format, ap );
-    funlockfile( stream );
+    _PDCLIB_flockfile( stream );
+    rc = _PDCLIB_vfprintf_unlocked( stream, format, ap );
+    _PDCLIB_funlockfile( stream );
     va_end( ap );
     return rc;
 }
index 2aaad4fdab6fc7cdf710a6a8d7a8e983eaebdef1..360abc459e32bec9ab94b22d4166211c817c5cb8 100644 (file)
@@ -15,7 +15,7 @@
    Returns c if successful, EOF otherwise.
    If a write error occurs, the error indicator of the stream is set.
 */
-int fputc_unlocked( int c, FILE * stream )
+int _PDCLIB_fputc_unlocked( int c, FILE * stream )
 {
     if ( _PDCLIB_prepwrite( stream ) == EOF )
     {
@@ -35,9 +35,9 @@ int fputc_unlocked( int c, FILE * stream )
 
 int fputc( int c, FILE * stream )
 {
-    flockfile( stream );
-    int r = fputc_unlocked( c, stream );
-    funlockfile( stream );
+    _PDCLIB_flockfile( stream );
+    int r = _PDCLIB_fputc_unlocked( c, stream );
+    _PDCLIB_funlockfile( stream );
     return r;
 }
 
index 0f92aaa7d1beaf64cec2931d4557ca949ef48a4b..3565a1181e73d4978b895b9d5b9a668819109e87 100644 (file)
@@ -11,7 +11,7 @@
 #ifndef REGTEST
 #include <_PDCLIB_io.h>
 
-int fputs_unlocked( const char * _PDCLIB_restrict s, 
+int _PDCLIB_fputs_unlocked( const char * _PDCLIB_restrict s, 
                     FILE * _PDCLIB_restrict stream )
 {
     if ( _PDCLIB_prepwrite( stream ) == EOF )
@@ -49,9 +49,9 @@ int fputs_unlocked( const char * _PDCLIB_restrict s,
 int fputs( const char * _PDCLIB_restrict s,
            FILE * _PDCLIB_restrict stream )
 {
-    flockfile( stream );
-    int r = fputs_unlocked( s, stream );
-    funlockfile( stream );
+    _PDCLIB_flockfile( stream );
+    int r = _PDCLIB_fputs_unlocked( s, stream );
+    _PDCLIB_funlockfile( stream );
     return r;
 }
 
index a0c23c31b989990b6062d2b2d223a384d9232205..9695db43bb1f43a833fb5a02447dce1dfe07886f 100644 (file)
@@ -14,7 +14,7 @@
 #include <stdbool.h>
 #include <string.h>
 
-size_t fread_unlocked( 
+size_t _PDCLIB_fread_unlocked( 
     void * _PDCLIB_restrict ptr, 
     size_t size, size_t nmemb, 
     FILE * _PDCLIB_restrict stream 
@@ -40,9 +40,9 @@ size_t fread( void * _PDCLIB_restrict ptr,
               size_t size, size_t nmemb, 
               FILE * _PDCLIB_restrict stream )
 {
-    flockfile( stream );
-    size_t r = fread_unlocked( ptr, size, nmemb, stream );
-    funlockfile( stream );
+    _PDCLIB_flockfile( stream );
+    size_t r = _PDCLIB_fread_unlocked( ptr, size, nmemb, stream );
+    _PDCLIB_funlockfile( stream );
     return r;
 }
 
index c8561225378cbbfaf22ebd359a4261e7acfb4120..fb356a820a6e32721a78c4a722d9fc0ace69f300 100644 (file)
@@ -20,7 +20,7 @@ FILE * freopen(
     FILE * _PDCLIB_restrict stream 
 )
 {
-    flockfile( stream );
+    _PDCLIB_flockfile( stream );
 
     unsigned int status = stream->status & 
         ( _IONBF | _IOLBF | _IOFBF | _PDCLIB_FREEBUFFER 
@@ -34,7 +34,7 @@ FILE * freopen(
     if ( ( filename == NULL ) && ( stream->filename == NULL ) )
     {
         /* TODO: Special handling for mode changes on std-streams */
-        funlockfile( stream );
+        _PDCLIB_funlockfile( stream );
         return NULL;
     }
     stream->ops->close(stream->handle);
@@ -43,7 +43,7 @@ FILE * freopen(
        It does not matter with the current implementation of clearerr(),
        but it might start to matter if someone replaced that implementation.
     */
-    clearerr( stream );
+    _PDCLIB_clearerr_unlocked( stream );
     /* The new filename might not fit the old buffer */
     if ( filename == NULL )
     {
@@ -60,19 +60,19 @@ FILE * freopen(
         /* Allocate new buffer */
         if ( ( stream->filename = (char *)malloc( strlen( filename ) ) ) == NULL )
         {
-            funlockfile( stream );
+            _PDCLIB_funlockfile( stream );
             return NULL;
         }
         strcpy( stream->filename, filename );
     }
     if ( ( mode == NULL ) || ( filename[0] == '\0' ) )
     {
-        funlockfile( stream );
+        _PDCLIB_funlockfile( stream );
         return NULL;
     }
     if ( ( stream->status = _PDCLIB_filemode( mode ) ) == 0 )
     {
-        funlockfile( stream );
+        _PDCLIB_funlockfile( stream );
         return NULL;
     }
     /* Re-add the flags we saved above */
@@ -84,10 +84,10 @@ FILE * freopen(
     if ( ! _PDCLIB_open( &stream->handle, &stream->ops, filename, 
                          stream->status ) )
     {
-        funlockfile( stream );
+        _PDCLIB_funlockfile( stream );
         return NULL;
     }
-    funlockfile( stream );
+    _PDCLIB_funlockfile( stream );
     return stream;
 }
 
index fbe280b4b6be6b0fc04a78ddb42ab194bc61f026..f9b950eee7edcbd4ec68f62532a4ea4ed20d84e2 100644 (file)
 #include <stdarg.h>
 
 #ifndef REGTEST
+#include <_PDCLIB_io.h>
 
-int fscanf_unlocked( FILE * _PDCLIB_restrict stream, 
+int _PDCLIB_fscanf_unlocked( FILE * _PDCLIB_restrict stream, 
                      const char * _PDCLIB_restrict format, ... )
 {
     int rc;
     va_list ap;
     va_start( ap, format );
-    rc = vfscanf_unlocked( stream, format, ap );
+    rc = _PDCLIB_vfscanf_unlocked( stream, format, ap );
     va_end( ap );
     return rc;
 }
index 35b641610da02e0e8a686c655e8fe3c516033b72..44cc6fbf86a8ca2f8a80bbace841f84ebd3453ad 100644 (file)
@@ -11,7 +11,7 @@
 #ifndef REGTEST
 #include <_PDCLIB_io.h>
 
-int fseek_unlocked( FILE * stream, long loffset, int whence )
+int _PDCLIB_fseek_unlocked( FILE * stream, long loffset, int whence )
 {
     _PDCLIB_int64_t offset = loffset;
     if ( stream->status & _PDCLIB_FWRITE )
@@ -30,7 +30,7 @@ int fseek_unlocked( FILE * stream, long loffset, int whence )
     if ( whence == SEEK_CUR )
     {
         whence  = SEEK_SET;
-        offset += _PDCLIB_ftell64( stream );
+        offset += _PDCLIB_ftell64_unlocked( stream );
     }
 
     return ( _PDCLIB_seek( stream, offset, whence ) != EOF ) ? 0 : EOF;
@@ -38,9 +38,9 @@ int fseek_unlocked( FILE * stream, long loffset, int whence )
 
 int fseek( FILE * stream, long loffset, int whence )
 {
-    flockfile( stream );
-    int r = fseek_unlocked( stream, loffset, whence );
-    funlockfile( stream );
+    _PDCLIB_flockfile( stream );
+    int r = _PDCLIB_fseek_unlocked( stream, loffset, whence );
+    _PDCLIB_funlockfile( stream );
     return r;
 }
 
index ed3c0a8cfc0372ffbc40fc97e403fbe9a020793a..5a78706731d7f8ee355fdf2e0a4acc55da34bdbf 100644 (file)
@@ -11,7 +11,7 @@
 #ifndef REGTEST
 #include <_PDCLIB_io.h>
 
-int fsetpos_unlocked( FILE * stream, 
+int _PDCLIB_fsetpos_unlocked( FILE * stream, 
                       const _PDCLIB_fpos_t * pos )
 {
     if ( stream->status & _PDCLIB_FWRITE )
@@ -33,9 +33,9 @@ int fsetpos_unlocked( FILE * stream,
 int fsetpos( FILE * stream, 
              const _PDCLIB_fpos_t * pos )
 {
-    flockfile( stream );
-    int res = fsetpos_unlocked( stream, pos );
-    funlockfile( stream );
+    _PDCLIB_flockfile( stream );
+    int res = _PDCLIB_fsetpos_unlocked( stream, pos );
+    _PDCLIB_funlockfile( stream );
     return res;
 }
 
index 441c9fc84c4d45edccd5964a943a482df0c125ca..ba79db3b8218268efaf100027dfbedbd6759b8bc 100644 (file)
@@ -12,8 +12,9 @@
 #include <errno.h>
 
 #ifndef REGTEST
+#include <_PDCLIB_io.h>
 
-long int ftell_unlocked( FILE * stream )
+long int _PDCLIB_ftell_unlocked( FILE * stream )
 {
     uint_fast64_t off64 = _PDCLIB_ftell64_unlocked( stream );
 
@@ -28,9 +29,9 @@ long int ftell_unlocked( FILE * stream )
 
 long int ftell( FILE * stream )
 {
-    flockfile( stream );
-    long int off = ftell_unlocked( stream );
-    funlockfile( stream );
+    _PDCLIB_flockfile( stream );
+    long int off = _PDCLIB_ftell_unlocked( stream );
+    _PDCLIB_funlockfile( stream );
     return off;
 }
 
index 41377dae2be619db99be32c4d1a24c375b21bfb5..994b51e850dc3fa7a6a9f0514f8e6609715e17fe 100644 (file)
@@ -12,7 +12,7 @@
 #include <threads.h>\r
 #include <stdlib.h>\r
 \r
-int ftrylockfile( FILE * file )\r
+int _PDCLIB_ftrylockfile( FILE * file )\r
 {\r
     int res = mtx_trylock( &file->lock );\r
     switch(res) {\r
index 648a22e4d62afc4159c1736a755dd57f4ab1d8ad..01133905ae8cce08657eace636a4e63c346ce9bb 100644 (file)
@@ -12,7 +12,7 @@
 #include <threads.h>\r
 #include <stdlib.h>\r
 \r
-void funlockfile( FILE * file )\r
+void _PDCLIB_funlockfile( FILE * file )\r
 {\r
     int res = mtx_unlock( &file->lock );\r
     switch(res) {\r
index 9319cf764afa8d16f3315a44c620fa59440d80d5..c9396bf6751fcf6df33fd3f0e73095f2a8b8ae5f 100644 (file)
@@ -17,7 +17,7 @@
 
 //TODO OS(2012-08-01): Ascertain purpose of lineend & potentially remove
 
-size_t fwrite_unlocked( const void * _PDCLIB_restrict ptr, 
+size_t _PDCLIB_fwrite_unlocked( const void * _PDCLIB_restrict ptr, 
                size_t size, size_t nmemb, 
                FILE * _PDCLIB_restrict stream )
 {
@@ -94,9 +94,9 @@ size_t fwrite( const void * _PDCLIB_restrict ptr,
                size_t size, size_t nmemb, 
                FILE * _PDCLIB_restrict stream )
 {
-    flockfile( stream );
-    size_t r = fwrite_unlocked( ptr, size, nmemb, stream );
-    funlockfile( stream );
+    _PDCLIB_flockfile( stream );
+    size_t r = _PDCLIB_fwrite_unlocked( ptr, size, nmemb, stream );
+    _PDCLIB_funlockfile( stream );
     return r;
 }
 
index e733d0b087b07368932cae511c067226de0f319e..b0c56f4c5cf3504f63a1785e32503b5783c14a8a 100644 (file)
@@ -9,10 +9,11 @@
 #include <stdio.h>
 
 #ifndef REGTEST
-
-int getc_unlocked( FILE * stream )
+#include <_PDCLIB_io.h>
+   
+int _PDCLIB_getc_unlocked( FILE * stream )
 {
-    return fgetc_unlocked( stream );
+    return _PDCLIB_fgetc_unlocked( stream );
 }
 
 int getc( FILE * stream )
index 406abe434f9dd4fefc3899eb13bf7c6794c9265c..1e761766bf5d79b27349be4d869a48469492b3b6 100644 (file)
@@ -9,10 +9,11 @@
 #include <stdio.h>
 
 #ifndef REGTEST
+#include <_PDCLIB_io.h>
 
-int getchar_unlocked( void )
+int _PDCLIB_getchar_unlocked( void )
 {
-    return fgetc_unlocked( stdin );
+    return _PDCLIB_fgetc_unlocked( stdin );
 }
 
 
index a12e137d8a3a0b71a8f35e537a452d5d34e68476..2b147e4b63f0e659b94a130c0ce1cff056c3af37 100644 (file)
@@ -22,12 +22,12 @@ int printf( const char * _PDCLIB_restrict format, ... )
     return rc;
 }
 
-int printf_unlocked( const char * _PDCLIB_restrict format, ... )
+int _PDCLIB_printf_unlocked( const char * _PDCLIB_restrict format, ... )
 {
     int rc;
     va_list ap;
     va_start( ap, format );
-    rc = vfprintf_unlocked( stdout, format, ap );
+    rc = _PDCLIB_vfprintf_unlocked( stdout, format, ap );
     va_end( ap );
     return rc;
 }
index 6bb2e9e58ce2e9b772687e9920c42b069ddf87d1..026e5e084e2972d5b612005b9072da6690e33409 100644 (file)
@@ -9,10 +9,11 @@
 #include <stdio.h>
 
 #ifndef REGTEST
+#include <_PDCLIB_io.h>
 
-int putc_unlocked( int c, FILE * stream )
+int _PDCLIB_putc_unlocked( int c, FILE * stream )
 {
-    return fputc_unlocked( c, stream );
+    return _PDCLIB_fputc_unlocked( c, stream );
 }
 
 
index 52063a57f713036c09a84a1e659ba2956f4a12fb..a79932f9e4f402ff444150c2054a59dcc2e5c378 100644 (file)
@@ -9,10 +9,11 @@
 #include <stdio.h>
 
 #ifndef REGTEST
+#include <_PDCLIB_io.h>
 
-int putchar_unlocked( int c )
+int _PDCLIB_putchar_unlocked( int c )
 {
-    return fputc_unlocked( c, stdout );
+    return _PDCLIB_fputc_unlocked( c, stdout );
 }
 
 int putchar( int c )
index 4e5522695d76dafcaef018ca6ab409144921f127..35daf64a85a39bb67f3a346122bce1b2d8566bfe 100644 (file)
@@ -9,11 +9,11 @@
 #include <stdio.h>
 
 #ifndef REGTEST
-#include <_PDCLIB_glue.h>
+#include <_PDCLIB_io.h>
 
 extern char * _PDCLIB_eol;
 
-int puts_unlocked( const char * s )
+int _PDCLIB_puts_unlocked( const char * s )
 {
     if ( _PDCLIB_prepwrite( stdout ) == EOF )
     {
@@ -44,9 +44,9 @@ int puts_unlocked( const char * s )
 
 int puts( const char * s )
 {
-    flockfile( stdout );
-    int r = puts_unlocked( s );
-    funlockfile( stdout );
+    _PDCLIB_flockfile( stdout );
+    int r = _PDCLIB_puts_unlocked( s );
+    _PDCLIB_funlockfile( stdout );
     return r;
 }
 
index 53ab51da9509b64a2fcb1567fb05a8b45de5eb45..18eb6a9dc33c575e8375523082b5b3ead223913e 100644 (file)
 #ifndef REGTEST
 #include <_PDCLIB_io.h>
 
-void rewind_unlocked( FILE * stream )
+void _PDCLIB_rewind_unlocked( FILE * stream )
 {
     stream->status &= ~ _PDCLIB_ERRORFLAG;
-    fseek_unlocked( stream, 0L, SEEK_SET );
+    _PDCLIB_fseek_unlocked( stream, 0L, SEEK_SET );
 }
 
 void rewind( FILE * stream )
 {
-    flockfile(stream);
-    rewind_unlocked(stream);
-    funlockfile(stream);
+    _PDCLIB_flockfile(stream);
+    _PDCLIB_rewind_unlocked(stream);
+    _PDCLIB_funlockfile(stream);
 }
 
 #endif
index e11ccbd653067908b8b7f7756ff3b0957ed0a803..7da1902a0826a574a13b44d1870a2cd1bfd4e116 100644 (file)
 #include <stdarg.h>
 
 #ifndef REGTEST
+#include <_PDCLIB_io.h>
 
-int scanf_unlocked( const char * _PDCLIB_restrict format, ... )
+int _PDCLIB_scanf_unlocked( const char * _PDCLIB_restrict format, ... )
 {
     va_list ap;
     va_start( ap, format );
-    return vfscanf_unlocked( stdin, format, ap );
+    return _PDCLIB_vfscanf_unlocked( stdin, format, ap );
 }
 
 int scanf( const char * _PDCLIB_restrict format, ... )
index d8470fc0edff1d91fcda0f9fc23b759b7045048d..b07d87e3f847e32de5927b260f7c818a62571f0a 100644 (file)
@@ -15,7 +15,7 @@
 
 int setvbuf( FILE * _PDCLIB_restrict stream, char * _PDCLIB_restrict buf, int mode, size_t size )
 {
-    _PDCLIB_lockfile( stream );
+    _PDCLIB_flockfile( stream );
     switch ( mode )
     {
         case _IONBF:
index cc6d1775ae66a50218a94b64e683b56d71ef0d63..59d2b57f6a00492e895eba080b261c45ac785f92 100644 (file)
@@ -11,7 +11,7 @@
 #ifndef REGTEST
 #include <_PDCLIB_io.h>
 
-int ungetc_unlocked( int c, FILE * stream )
+int _PDCLIB_ungetc_unlocked( int c, FILE * stream )
 {
     if ( c == EOF || stream->ungetidx == _PDCLIB_UNGETCBUFSIZE )
     {
@@ -22,9 +22,9 @@ int ungetc_unlocked( int c, FILE * stream )
 
 int ungetc( int c, FILE * stream )
 {
-    flockfile( stream );
-    int r = ungetc_unlocked( c, stream );
-    funlockfile( stream);
+    _PDCLIB_flockfile( stream );
+    int r = _PDCLIB_ungetc_unlocked( c, stream );
+    _PDCLIB_funlockfile( stream);
     return r;
 }
 
index b8e91943b2449057cb4e144f8546d4fbe2882191..9be5b2d7f29b1cf89138c4036826984ea080965e 100644 (file)
@@ -14,7 +14,7 @@
 #ifndef REGTEST
 #include <_PDCLIB_io.h>
 
-int vfprintf_unlocked( FILE * _PDCLIB_restrict stream, 
+int _PDCLIB_vfprintf_unlocked( FILE * _PDCLIB_restrict stream, 
                        const char * _PDCLIB_restrict format, 
                        va_list arg )
 {
@@ -54,9 +54,9 @@ int vfprintf( FILE * _PDCLIB_restrict stream,
               const char * _PDCLIB_restrict format, 
               va_list arg )
 {
-    flockfile( stream );
-    int r = vfprintf_unlocked( stream, format, arg );
-    funlockfile( stream );
+    _PDCLIB_flockfile( stream );
+    int r = _PDCLIB_vfprintf_unlocked( stream, format, arg );
+    _PDCLIB_funlockfile( stream );
     return r;
 }
 
index 14bba50879c557a2837e78717e7bdd73de785c87..bd5a68121bb1b1a56de023428b542d921e68c252 100644 (file)
@@ -13,7 +13,7 @@
 #ifndef REGTEST
 #include <_PDCLIB_io.h>
 
-int vfscanf_unlocked( FILE * _PDCLIB_restrict stream, 
+int _PDCLIB_vfscanf_unlocked( FILE * _PDCLIB_restrict stream, 
                       const char * _PDCLIB_restrict format, 
                       va_list arg )
 {
@@ -47,18 +47,18 @@ int vfscanf_unlocked( FILE * _PDCLIB_restrict stream,
                 }
                 if ( ! feof( stream ) )
                 {
-                    ungetc( c, stream );
+                    _PDCLIB_ungetc_unlocked( c, stream );
                 }
             }
             else
             {
                 /* Non-whitespace char in format string: Match verbatim */
-                if ( ( ( c = getc( stream ) ) != *format ) || feof( stream ) )
+                if ( ( ( c = _PDCLIB_getc_unlocked( stream ) ) != *format ) || feof( stream ) )
                 {
                     /* Matching error */
                     if ( ! feof( stream ) && ! ferror( stream ) )
                     {
-                        ungetc( c, stream );
+                        _PDCLIB_ungetc_unlocked( c, stream );
                     }
                     else if ( status.n == 0 )
                     {
@@ -92,9 +92,9 @@ int vfscanf( FILE * _PDCLIB_restrict stream,
              const char * _PDCLIB_restrict format, 
              va_list arg )
 {
-    flockfile( stream );
-    int r = vfscanf_unlocked( stream, format, arg );
-    funlockfile( stream );
+    _PDCLIB_flockfile( stream );
+    int r = _PDCLIB_vfscanf_unlocked( stream, format, arg );
+    _PDCLIB_funlockfile( stream );
     return r;
 }
 
index 6eba229114e8fb9eb530c60a15df22b92f477da5..ae2b0377863a94674e1a45eb2b5afe21472938d6 100644 (file)
 #include <stdarg.h>
 
 #ifndef REGTEST
+#include <_PDCLIB_io.h>
 
-int vprintf_unlocked( const char * _PDCLIB_restrict format, 
-                      _PDCLIB_va_list arg )
+int _PDCLIB_vprintf_unlocked( const char * _PDCLIB_restrict format, 
+                              _PDCLIB_va_list arg )
 {
-    return vfprintf_unlocked( stdout, format, arg );
+    return _PDCLIB_vfprintf_unlocked( stdout, format, arg );
 }
 
 int vprintf( const char * _PDCLIB_restrict format, _PDCLIB_va_list arg )
index dc3a236a2bd552e24bed4e2c27d3a468fb6cbae6..3e4ada482a1e8074aeef459312485b4cfe87c476 100644 (file)
 #include <stdarg.h>
 
 #ifndef REGTEST
+#include <_PDCLIB_io.h>
 
-int vscanf_unlocked( const char * _PDCLIB_restrict format, _PDCLIB_va_list arg )
+int _PDCLIB_vscanf_unlocked( const char * _PDCLIB_restrict format, 
+                             _PDCLIB_va_list arg )
 {
-    return vfscanf_unlocked( stdin, format, arg );
+    return _PDCLIB_vfscanf_unlocked( stdin, format, arg );
 }
 
 int vscanf( const char * _PDCLIB_restrict format, _PDCLIB_va_list arg )
index e4fd94ef3fce28d3d21a6e7c73ecfda57b1d8fd0..65b658901ca1293f1cf51d41102aa7b2db74e93d 100644 (file)
@@ -168,7 +168,7 @@ struct _PDCLIB_fileops
                      _PDCLIB_size_t length, _PDCLIB_size_t * numCharsWritten );\r
 };\r
 \r
-/* FILE structure */\r
+/* struct _PDCLIB_file structure */\r
 struct _PDCLIB_file\r
 {\r
     const _PDCLIB_fileops_t * ops;\r
@@ -223,4 +223,47 @@ static inline _PDCLIB_size_t _PDCLIB_getchars( char * out, _PDCLIB_size_t n,
     return i;\r
 }\r
 \r
+/* Unlocked functions - internal names \r
+ *\r
+ * We can't use the functions using their "normal" names internally because that\r
+ * would cause namespace leakage. Therefore, we use them by prefixed internal \r
+ * names\r
+ */\r
+void _PDCLIB_flockfile(struct _PDCLIB_file *file) _PDCLIB_nothrow;\r
+int _PDCLIB_ftrylockfile(struct _PDCLIB_file *file) _PDCLIB_nothrow;\r
+void _PDCLIB_funlockfile(struct _PDCLIB_file *file) _PDCLIB_nothrow;\r
+\r
+int _PDCLIB_getc_unlocked(struct _PDCLIB_file *stream) _PDCLIB_nothrow;\r
+int _PDCLIB_getchar_unlocked(void) _PDCLIB_nothrow;\r
+int _PDCLIB_putc_unlocked(int c, struct _PDCLIB_file *stream) _PDCLIB_nothrow;\r
+int _PDCLIB_putchar_unlocked(int c) _PDCLIB_nothrow;\r
+void _PDCLIB_clearerr_unlocked(struct _PDCLIB_file *stream) _PDCLIB_nothrow; \r
+int _PDCLIB_feof_unlocked(struct _PDCLIB_file *stream) _PDCLIB_nothrow;\r
+int _PDCLIB_ferror_unlocked(struct _PDCLIB_file *stream) _PDCLIB_nothrow;\r
+int _PDCLIB_fflush_unlocked(struct _PDCLIB_file *stream) _PDCLIB_nothrow;\r
+int _PDCLIB_fgetc_unlocked(struct _PDCLIB_file *stream) _PDCLIB_nothrow;\r
+int _PDCLIB_fputc_unlocked(int c, struct _PDCLIB_file *stream) _PDCLIB_nothrow;\r
+_PDCLIB_size_t _PDCLIB_fread_unlocked(void *ptr, _PDCLIB_size_t size, _PDCLIB_size_t n, struct _PDCLIB_file *stream) _PDCLIB_nothrow;\r
+_PDCLIB_size_t _PDCLIB_fwrite_unlocked(const void *ptr, _PDCLIB_size_t size, _PDCLIB_size_t n, struct _PDCLIB_file *stream) _PDCLIB_nothrow;\r
+char *_PDCLIB_fgets_unlocked(char *s, int n, struct _PDCLIB_file *stream) _PDCLIB_nothrow;\r
+int _PDCLIB_fputs_unlocked(const char *s, struct _PDCLIB_file *stream) _PDCLIB_nothrow;\r
+int _PDCLIB_fgetpos_unlocked( struct _PDCLIB_file * _PDCLIB_restrict stream, _PDCLIB_fpos_t * _PDCLIB_restrict pos ) _PDCLIB_nothrow;\r
+int _PDCLIB_fsetpos_unlocked( struct _PDCLIB_file * stream, const _PDCLIB_fpos_t * pos ) _PDCLIB_nothrow;\r
+long int _PDCLIB_ftell_unlocked( struct _PDCLIB_file * stream ) _PDCLIB_nothrow;\r
+int _PDCLIB_fseek_unlocked( struct _PDCLIB_file * stream, long int offset, int whence ) _PDCLIB_nothrow;\r
+void _PDCLIB_rewind_unlocked( struct _PDCLIB_file * stream ) _PDCLIB_nothrow;\r
+\r
+int _PDCLIB_puts_unlocked( const char * s ) _PDCLIB_nothrow;\r
+int _PDCLIB_ungetc_unlocked( int c, struct _PDCLIB_file * stream ) _PDCLIB_nothrow;\r
+\r
+\r
+int _PDCLIB_printf_unlocked( const char * _PDCLIB_restrict format, ... ) _PDCLIB_nothrow;\r
+int _PDCLIB_vprintf_unlocked( const char * _PDCLIB_restrict format, _PDCLIB_va_list arg ) _PDCLIB_nothrow;\r
+int _PDCLIB_fprintf_unlocked( struct _PDCLIB_file * _PDCLIB_restrict stream, const char * _PDCLIB_restrict format, ... ) _PDCLIB_nothrow;\r
+int _PDCLIB_vfprintf_unlocked( struct _PDCLIB_file * _PDCLIB_restrict stream, const char * _PDCLIB_restrict format, _PDCLIB_va_list arg ) _PDCLIB_nothrow;\r
+int _PDCLIB_scanf_unlocked( const char * _PDCLIB_restrict format, ... ) _PDCLIB_nothrow;\r
+int _PDCLIB_vscanf_unlocked( const char * _PDCLIB_restrict format, _PDCLIB_va_list arg ) _PDCLIB_nothrow;\r
+int _PDCLIB_fscanf_unlocked( struct _PDCLIB_file * _PDCLIB_restrict stream, const char * _PDCLIB_restrict format, ... ) _PDCLIB_nothrow;\r
+int _PDCLIB_vfscanf_unlocked( struct _PDCLIB_file * _PDCLIB_restrict stream, const char * _PDCLIB_restrict format, _PDCLIB_va_list arg ) _PDCLIB_nothrow;\r
+\r
 #endif\r