- /* Normally, on output, there will never be a situation where
- the write buffer is full, but it hasn't been written out.
- If we find this to be the case, then it is because we have
- done an fseek, and didn't know whether we were going to do
- a read or a write after it, so now that we know, we switch
- the buffer to being set up for write. We could use a flag,
- but I thought it would be better to just put some magic
- code in with a comment */
- if (stream->upto == stream->endbuf)
- {
- stream->bufStartR += (stream->endbuf - stream->fbuf);
- stream->upto = stream->fbuf;
- stream->mode = __WRITE_MODE;
- }
- if ((stream->textMode) || (stream->bufTech == _IOLBF))
- {
- fwriteSlowT(ptr, stream, towrite, &actualWritten);
- }
- else
- {
- fwriteSlowB(ptr, stream, towrite, &actualWritten);
- }
- if (nmemb == 1)
- {
- if (actualWritten == size)
- {
- *elemWritten = 1;
- }
- else
- {
- *elemWritten = 0;
- }
- }
- else if (size == 1)
- {
- *elemWritten = actualWritten;
- }
- else
+size_t _PDCLIB_fwrite_unlocked( const void *restrict vptr,
+ size_t size, size_t nmemb,
+ FILE * _PDCLIB_restrict stream )
+{
+ if ( _PDCLIB_prepwrite( stream ) == EOF )