FILE* __fastcall__ fdopen (int handle, const char* /*mode*/)
{
- FILE* f;
+ register FILE* f;
/* Find a free file slot */
- if (!(f = _fdesc ())) {
+ if ((f = _fdesc ())) {
+ /* Insert the handle, and return the descriptor */
+ f->f_fd = handle;
+ f->f_flags = _FOPEN;
+ } else {
/* No slots */
- return (FILE*) _seterrno (EMFILE); /* Too many files */
+ _seterrno (EMFILE); /* Too many files */
}
- /* Insert the handle, and return the descriptor */
- f->f_fd = handle;
- f->f_flags = _FOPEN;
-
/* Return the file descriptor */
return f;
}