Use bitfield `flags` flags in file instead of `int` variables `mode`, `error`, `eof`. And rewrite weird logic opening/close files Reviewed-on: #691 Reviewed-by: Ivan B <1+dunkaist@noreply.localhost> Reviewed-by: Kiril Lipatov <lipatov.kiril@gmail.com> Co-authored-by: Egor00f <y.yarin@inbox.ru>
17 lines
207 B
C
17 lines
207 B
C
#include "_stdio.h"
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
|
|
int fclose(FILE* stream)
|
|
{
|
|
int err = fclose_r(stream);
|
|
|
|
if (err) {
|
|
return err;
|
|
}
|
|
|
|
free(stream);
|
|
stream = NULL;
|
|
return 0;
|
|
}
|