The memory pools store puddles near head of the allocation list and the large allocations near the tail of the list.
Some hints added to point to side-effects which might apply to memory allocation operations.
The 'struct tm' is now properly updated to reflect the time and date information which comes out of the number of seconds calculated.
A bug reported by Andreas Falkenhahn is resolved which had the effect of distorting the number of seconds calculated.
If the stream is unbuffered and turns out to be an interactive stream (e.g. stderr) then output will be made to follow the rules of line buffering to yield better readability of the output. Similar code exists with fputs(), for example.
fwrite() now tries to fill the write buffer as far is possible and will only resort to using the __putc() macros when necessary. This should improve write performance by quite a bit.
If the write buffer happens to be empty and the number of bytes to write is at least as large as the write buffer, then fwrite() will directly call write(). This should improve write performance, too.
If the file is in unbuffered mode, fwrite() now always calls write(), bypassing the write buffer altogether.
Setting the buffer size to 0 had the effect of switching the buffering mode. This is a bad idea since it wasn't actually called for: this is what the 'bufmode' parameter is intended for. What happens now is that the default buffer size is used (BUFSIZ), which sort of follows what the BSD libc did: a zero buffer size delayed the allocation of a buffer until the first read/write access occured.
gets() now tries to copy as much data from the read buffer as possible, and will fall back onto using the __getc() macro only if necessary. This should improve performance on long lines, or crash faster if the read buffer happens to be too short. This is probably wasted on gets(), but you never know...
If the buffer mode is set to "no buffering" then fread() will always bypass the buffer and call read() instead.
If there is enough data waiting to be read from the buffer, fread() will now copy it directly, refilling the buffer as needed.
If the read buffer happens to be empty, buffering is enabled for the stream, and the number of bytes to read is at least as large as the buffer size, then fread() will directly call read(), which should improve performance significantly.
fgets() now copies as much data from the read buffer as possible, falling back onto the __getc() macro only as a last resort. This should help greatly when reading long lines since the overhead of calling __getc() goes away.