]> pd.if.org Git - pdclib.old/blobdiff - functions/stdio/fflush.c
Minimize the amount of internal definitions which get exposed via the user-visible...
[pdclib.old] / functions / stdio / fflush.c
index b8d32ec307d45b389d3a0fa37fb79263998e9f16..e03079fcc9c17fdf661a961b77fdbec46cbbab60 100644 (file)
@@ -9,11 +9,11 @@
 #include <stdio.h>
 
 #ifndef REGTEST
-#include <_PDCLIB_glue.h>
+#include <_PDCLIB_io.h>
 
-extern struct _PDCLIB_file_t * _PDCLIB_filelist;
+extern FILE * _PDCLIB_filelist;
 
-int fflush( struct _PDCLIB_file_t * stream )
+int fflush_unlocked( FILE * stream )
 {
     if ( stream == NULL )
     {
@@ -38,6 +38,14 @@ int fflush( struct _PDCLIB_file_t * stream )
         return _PDCLIB_flushbuffer( stream );
     }
 }
+
+int fflush( FILE * stream )
+{
+    flockfile( stream );
+    int res = fflush_unlocked(stream);
+    funlockfile( stream );
+    return res;
+}
                 
 #endif