source: asp3_tinet_ecnl_arm/trunk/musl-1.1.18/src/stdio/fclose.c@ 352

Last change on this file since 352 was 352, checked in by coas-nagasima, 6 years ago

arm向けASP3版ECNLを追加

  • Property svn:eol-style set to native
  • Property svn:mime-type set to text/x-csrc;charset=UTF-8
File size: 600 bytes
Line 
1#include "stdio_impl.h"
2#include "libc.h"
3
4#ifndef __c2__
5static void dummy(FILE *f) { }
6weak_alias(dummy, __unlist_locked_file);
7#else
8extern void __unlist_locked_file(FILE *f);
9#endif
10
11int fclose(FILE *f)
12{
13 int r;
14 int perm;
15
16 FLOCK(f);
17
18 __unlist_locked_file(f);
19
20 if (!(perm = f->flags & F_PERM)) {
21 FILE **head = __ofl_lock();
22 if (f->prev) f->prev->next = f->next;
23 if (f->next) f->next->prev = f->prev;
24 if (*head == f) *head = f->next;
25 __ofl_unlock();
26 }
27
28 r = fflush(f);
29 r |= f->close(f);
30
31 if (f->getln_buf) free(f->getln_buf);
32 if (!perm) free(f);
33 else FUNLOCK(f);
34
35 return r;
36}
Note: See TracBrowser for help on using the repository browser.