#ifndef REGTEST
-int ungetc( int c, struct _PDCLIB_file_t * _PDCLIB_restrict stream )
+int ungetc_unlocked( int c, struct _PDCLIB_file_t * stream )
{
if ( c == EOF || stream->ungetidx == _PDCLIB_UNGETCBUFSIZE )
{
return stream->ungetbuf[stream->ungetidx++] = (unsigned char) c;
}
+int ungetc( int c, struct _PDCLIB_file_t * stream )
+{
+ flockfile( stream );
+ int r = ungetc_unlocked( c, stream );
+ funlockfile( stream);
+ return r;
+}
+
#endif
#ifdef TEST