refactor stdio open file list handling, move it out of global libc struct
authorRich Felker <dalias@aerifal.cx>
Tue, 16 Jun 2015 07:11:19 +0000 (07:11 +0000)
committerRich Felker <dalias@aerifal.cx>
Tue, 16 Jun 2015 07:11:19 +0000 (07:11 +0000)
commit1b0cdc8700d29ef018bf226d74b2b58b23bce91c
tree53c58824a9d73de47296b5a8885aefc9a1f39d0b
parentf22a9edaf8a6f2ca1d314d18b3785558279a5c03
refactor stdio open file list handling, move it out of global libc struct

functions which open in-memory FILE stream variants all shared a tail
with __fdopen, adding the FILE structure to stdio's open file list.
replacing this common tail with a function call reduces code size and
duplication of logic. the list is also partially encapsulated now.

function signatures were chosen to facilitate tail call optimization
and reduce the need for additional accessor functions.

with these changes, static linked programs that do not use stdio no
longer have an open file list at all.
12 files changed:
src/internal/libc.h
src/internal/stdio_impl.h
src/stdio/__fdopen.c
src/stdio/__stdio_exit.c
src/stdio/fclose.c
src/stdio/fflush.c
src/stdio/fmemopen.c
src/stdio/ofl.c [new file with mode: 0644]
src/stdio/ofl_add.c [new file with mode: 0644]
src/stdio/open_memstream.c
src/stdio/open_wmemstream.c
src/thread/pthread_create.c