OSDN Git Service

libc/stdio: Rework custom streams interface similar to glibc.
authorWaldemar Brodkorb <wbx@openadk.org>
Wed, 9 Dec 2015 07:05:10 +0000 (08:05 +0100)
committerWaldemar Brodkorb <wbx@uclibc-ng.org>
Thu, 17 Dec 2015 20:15:26 +0000 (21:15 +0100)
commit6fd4a1a04133213815fdb240a9d1c059d1a5de9f
tree20cd29fd533867ff67223ce416683efcd14da36c
parent8fb67ff51617206c7095735c03dc31a6cd3a7b96
libc/stdio: Rework custom streams interface similar to glibc.

Save 20 bytes per FILE structure, avoid indirect call for
read/write/seek/close operations for normal streams.
Additionally, custom streams has fileno = -2 now, like in glibc.

bloat-o-meter report (UCLIBC_HAS_GLIBC_CUSTOM_STREAMS=y):
function                                             old     new   delta
fopencookie                                           69     131     +62
ftello64                                             233     260     +27
fseeko64                                             298     319     +21
fclose                                               423     442     +19
.rodata                                            16696   16708     +12
fileno_unlocked                                       53      45      -8
__ns_name_pack                                       859     851      -8
vswscanf                                             184     144     -40
vdprintf                                             231     187     -44
vsscanf                                              210     151     -59
vswprintf                                            269     201     -68
vsnprintf                                            249     181     -68
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 5/7 up/down: 141/-295)         Total: -154 bytes

Signed-off-by: Leonid Lisovskiy <lly.dev@gmail.com>
Signed-off-by: Waldemar Brodkorb <wbx@uclibc-ng.org>
17 files changed:
libc/stdio/_READ.c
libc/stdio/_WRITE.c
libc/stdio/_cs_funcs.c
libc/stdio/_fopen.c
libc/stdio/_rfill.c
libc/stdio/_scanf.c
libc/stdio/_stdio.c
libc/stdio/_stdio.h
libc/stdio/fclose.c
libc/stdio/fopencookie.c
libc/stdio/fread.c
libc/stdio/vdprintf.c
libc/stdio/vsnprintf.c
libc/stdio/vswprintf.c
libc/sysdeps/linux/common/bits/uClibc_stdio.h
test/stdio/Makefile.in
test/stdio/tst-fmemopen.c [new file with mode: 0644]