* Sync up to trunk HEAD (r62285). Branch guys deserve the significant speedups too ;)

svn path=/branches/shell-experiments/; revision=62286
This commit is contained in:
Amine Khaldi 2014-02-22 10:31:26 +00:00
commit ddb3d908c9
1259 changed files with 40366 additions and 5588 deletions

View file

@ -734,10 +734,8 @@ int CDECL _wunlink(const wchar_t *path)
/* _flushall calls fflush which calls _flushall */
int CDECL fflush(FILE* file);
/*********************************************************************
* _flushall (MSVCRT.@)
*/
int CDECL _flushall(void)
/* INTERNAL: Flush all stream buffer */
static int flush_all_buffers(int mask)
{
int i, num_flushed = 0;
FILE *file;
@ -748,8 +746,8 @@ int CDECL _flushall(void)
if (file->_flag)
{
if(file->_flag & _IOWRT) {
fflush(file);
if(file->_flag & mask) {
fflush(file);
num_flushed++;
}
}
@ -760,22 +758,41 @@ int CDECL _flushall(void)
return num_flushed;
}
/*********************************************************************
* _flushall (MSVCRT.@)
*/
int CDECL _flushall(void)
{
return flush_all_buffers(_IOWRT | _IOREAD);
}
/*********************************************************************
* fflush (MSVCRT.@)
*/
int CDECL fflush(FILE* file)
{
if(!file) {
_flushall();
flush_all_buffers(_IOWRT);
} else if(file->_flag & _IOWRT) {
int res;
_lock_file(file);
res = flush_buffer(file);
/* FIXME
if(!res && (file->_flag & _IOCOMMIT))
res = _commit(file->_file) ? EOF : 0;
*/
_unlock_file(file);
return res;
}
} else if(file->_flag & _IOREAD) {
_lock_file(file);
file->_cnt = 0;
file->_ptr = file->_base;
_unlock_file(file);
return 0;
}
return 0;
}