diff options
Diffstat (limited to 'libio')
159 files changed, 581 insertions, 965 deletions
diff --git a/libio/Makefile b/libio/Makefile index 7b3bcf90fe..4189bc4ad0 100644 --- a/libio/Makefile +++ b/libio/Makefile @@ -1,4 +1,4 @@ -# Copyright (C) 1995-2015 Free Software Foundation, Inc. +# Copyright (C) 1995-2016 Free Software Foundation, Inc. # This file is part of the GNU C Library. # The GNU C Library is free software; you can redistribute it and/or @@ -22,7 +22,7 @@ subdir := libio include ../Makeconfig -headers := stdio.h libio.h _G_config.h bits/stdio.h bits/stdio-lock.h \ +headers := stdio.h libio.h _G_config.h bits/stdio.h \ bits/sys_errlist.h bits/stdio2.h bits/stdio-ldbl.h bits/libio-ldbl.h routines := \ @@ -84,72 +84,74 @@ endif CPPFLAGS += $(libio-mtsafe) # Support for exception handling. -CFLAGS-fileops.c = $(exceptions) -CFLAGS-fputc.c = $(exceptions) -CFLAGS-fputwc.c = $(exceptions) -CFLAGS-freopen64.c = $(exceptions) -CFLAGS-freopen.c = $(exceptions) -CFLAGS-fseek.c = $(exceptions) -CFLAGS-fseeko64.c = $(exceptions) -CFLAGS-fseeko.c = $(exceptions) -CFLAGS-ftello64.c = $(exceptions) -CFLAGS-ftello.c = $(exceptions) -CFLAGS-fwide.c = $(exceptions) -CFLAGS-genops.c = $(exceptions) -CFLAGS-getc.c = $(exceptions) -CFLAGS-getchar.c = $(exceptions) -CFLAGS-getwc.c = $(exceptions) -CFLAGS-getwchar.c = $(exceptions) -CFLAGS-iofclose.c = $(exceptions) -CFLAGS-iofflush.c = $(exceptions) -CFLAGS-iofgetpos64.c = $(exceptions) -CFLAGS-iofgetpos.c = $(exceptions) -CFLAGS-iofgets.c = $(exceptions) -CFLAGS-iofgetws.c = $(exceptions) -CFLAGS-iofputs.c = $(exceptions) -CFLAGS-iofputws.c = $(exceptions) -CFLAGS-iofread.c = $(exceptions) -CFLAGS-iofsetpos64.c = $(exceptions) -CFLAGS-iofsetpos.c = $(exceptions) -CFLAGS-ioftell.c = $(exceptions) -CFLAGS-iofwrite.c = $(exceptions) -CFLAGS-iogetdelim.c = $(exceptions) -CFLAGS-iogetline.c = $(exceptions) -CFLAGS-iogets.c = $(exceptions) -CFLAGS-iogetwline.c = $(exceptions) -CFLAGS-ioputs.c = $(exceptions) -CFLAGS-ioseekoff.c = $(exceptions) -CFLAGS-ioseekpos.c = $(exceptions) -CFLAGS-iosetbuffer.c = $(exceptions) -CFLAGS-iosetvbuf.c = $(exceptions) -CFLAGS-ioungetc.c = $(exceptions) -CFLAGS-ioungetwc.c = $(exceptions) -CFLAGS-oldfileops.c = $(exceptions) -CFLAGS-oldiofclose.c = $(exceptions) -CFLAGS-oldiofgetpos64.c = $(exceptions) -CFLAGS-oldiofgetpos.c = $(exceptions) -CFLAGS-oldiofsetpos64.c = $(exceptions) -CFLAGS-oldiofsetpos.c = $(exceptions) -CFLAGS-peekc.c = $(exceptions) -CFLAGS-putc.c = $(exceptions) -CFLAGS-putchar.c = $(exceptions) -CFLAGS-putwc.c = $(exceptions) -CFLAGS-putwchar.c = $(exceptions) -CFLAGS-rewind.c = $(exceptions) -CFLAGS-wfileops.c = $(exceptions) -CFLAGS-wgenops.c = $(exceptions) -CFLAGS-oldiofopen.c = $(exceptions) -CFLAGS-iofopen.c = $(exceptions) -CFLAGS-iofopen64.c = $(exceptions) -CFLAGS-oldtmpfile.c = $(exceptions) +CFLAGS-fileops.c = -fexceptions +CFLAGS-fputc.c = -fexceptions +CFLAGS-fputwc.c = -fexceptions +CFLAGS-freopen64.c = -fexceptions +CFLAGS-freopen.c = -fexceptions +CFLAGS-fseek.c = -fexceptions +CFLAGS-fseeko64.c = -fexceptions +CFLAGS-fseeko.c = -fexceptions +CFLAGS-ftello64.c = -fexceptions +CFLAGS-ftello.c = -fexceptions +CFLAGS-fwide.c = -fexceptions +CFLAGS-genops.c = -fexceptions +CFLAGS-getc.c = -fexceptions +CFLAGS-getchar.c = -fexceptions +CFLAGS-getwc.c = -fexceptions +CFLAGS-getwchar.c = -fexceptions +CFLAGS-iofclose.c = -fexceptions +CFLAGS-iofflush.c = -fexceptions +CFLAGS-iofgetpos64.c = -fexceptions +CFLAGS-iofgetpos.c = -fexceptions +CFLAGS-iofgets.c = -fexceptions +CFLAGS-iofgetws.c = -fexceptions +CFLAGS-iofputs.c = -fexceptions +CFLAGS-iofputws.c = -fexceptions +CFLAGS-iofread.c = -fexceptions +CFLAGS-iofsetpos64.c = -fexceptions +CFLAGS-iofsetpos.c = -fexceptions +CFLAGS-ioftell.c = -fexceptions +CFLAGS-iofwrite.c = -fexceptions +CFLAGS-iogetdelim.c = -fexceptions +CFLAGS-iogetline.c = -fexceptions +CFLAGS-iogets.c = -fexceptions +CFLAGS-iogetwline.c = -fexceptions +CFLAGS-ioputs.c = -fexceptions +CFLAGS-ioseekoff.c = -fexceptions +CFLAGS-ioseekpos.c = -fexceptions +CFLAGS-iosetbuffer.c = -fexceptions +CFLAGS-iosetvbuf.c = -fexceptions +CFLAGS-ioungetc.c = -fexceptions +CFLAGS-ioungetwc.c = -fexceptions +CFLAGS-oldfileops.c = -fexceptions +CFLAGS-oldiofclose.c = -fexceptions +CFLAGS-oldiofgetpos64.c = -fexceptions +CFLAGS-oldiofgetpos.c = -fexceptions +CFLAGS-oldiofsetpos64.c = -fexceptions +CFLAGS-oldiofsetpos.c = -fexceptions +CFLAGS-peekc.c = -fexceptions +CFLAGS-putc.c = -fexceptions +CFLAGS-putchar.c = -fexceptions +CFLAGS-putwc.c = -fexceptions +CFLAGS-putwchar.c = -fexceptions +CFLAGS-rewind.c = -fexceptions +CFLAGS-wfileops.c = -fexceptions +CFLAGS-wgenops.c = -fexceptions +CFLAGS-oldiofopen.c = -fexceptions +CFLAGS-iofopen.c = -fexceptions +CFLAGS-iofopen64.c = -fexceptions +CFLAGS-oldtmpfile.c = -fexceptions # XXX Do we need filedoalloc and wfiledoalloc? Others? CFLAGS-tst_putwc.c = -DOBJPFX=\"$(objpfx)\" tst_wprintf2-ARGS = "Some Text" +test-fmemopen-ENV = MALLOC_TRACE=$(objpfx)test-fmemopen.mtrace tst-fopenloc-ENV = MALLOC_TRACE=$(objpfx)tst-fopenloc.mtrace +generated += test-fmemopen.mtrace test-fmemopen.check generated += tst-fopenloc.mtrace tst-fopenloc.check aux := fileops genops stdfiles stdio strops @@ -164,7 +166,7 @@ shared-only-routines = oldiofopen oldiofdopen oldiofclose oldfileops \ oldiofsetpos64 ifeq ($(run-built-tests),yes) -tests-special += $(objpfx)test-freopen.out +tests-special += $(objpfx)test-freopen.out $(objpfx)test-fmemopen-mem.out ifeq (yes,$(build-shared)) # Run tst-fopenloc-cmp.out and tst-openloc-mem.out only if shared # library is enabled since they depend on tst-fopenloc.out. @@ -174,6 +176,30 @@ endif include ../Rules +ifeq ($(run-built-tests),yes) +LOCALES := de_DE.ISO-8859-1 de_DE.UTF-8 en_US.ISO-8859-1 en_US.UTF-8 \ + ja_JP.EUC-JP ja_JP.UTF-8 +include ../gen-locales.mk + +$(objpfx)bug-ftell.out: $(gen-locales) +$(objpfx)bug-ungetwc1.out: $(gen-locales) +$(objpfx)bug-ungetwc2.out: $(gen-locales) +$(objpfx)tst-fgetwc.out: $(gen-locales) +$(objpfx)tst-fgetws.out: $(gen-locales) +$(objpfx)tst-fopenloc.out: $(gen-locales) +$(objpfx)tst-fputws.out: $(gen-locales) +$(objpfx)tst-fseek.out: $(gen-locales) +$(objpfx)tst-ftell-active-handler.out: $(gen-locales) +$(objpfx)tst-ftell-append.out: $(gen-locales) +$(objpfx)tst-ftell-partial-wide.out: $(gen-locales) +$(objpfx)tst-setvbuf1.out: $(gen-locales) +$(objpfx)tst-swscanf.out: $(gen-locales) +$(objpfx)tst-ungetwc1.out: $(gen-locales) +$(objpfx)tst-ungetwc2.out: $(gen-locales) +$(objpfx)tst-widetext.out: $(gen-locales) +$(objpfx)tst_wprintf2.out: $(gen-locales) +endif + $(objpfx)test-freopen.out: test-freopen.sh $(objpfx)test-freopen $(SHELL) $< $(common-objpfx) '$(test-program-prefix)' \ $(common-objpfx)libio/; \ @@ -184,6 +210,10 @@ $(objpfx)tst-fopenloc-cmp.out: ../iconvdata/testdata/ISO-8859-1..UTF8 \ cmp $^ > $@; \ $(evaluate-test) +$(objpfx)test-fmemopen-mem.out: $(objpfx)test-fmemopen.out + $(common-objpfx)malloc/mtrace $(objpfx)test-fmemopen.mtrace > $@; \ + $(evaluate-test) + $(objpfx)tst-fopenloc-mem.out: $(objpfx)tst-fopenloc.out $(common-objpfx)malloc/mtrace $(objpfx)tst-fopenloc.mtrace > $@; \ $(evaluate-test) diff --git a/libio/__fbufsize.c b/libio/__fbufsize.c index e6a07d44b0..9acbf244bc 100644 --- a/libio/__fbufsize.c +++ b/libio/__fbufsize.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2015 Free Software Foundation, Inc. +/* Copyright (C) 2000-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/libio/__flbf.c b/libio/__flbf.c index 631cd6f799..dcb7eaa0d1 100644 --- a/libio/__flbf.c +++ b/libio/__flbf.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2015 Free Software Foundation, Inc. +/* Copyright (C) 2000-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/libio/__fpending.c b/libio/__fpending.c index 52e790fd9c..0dc6915d18 100644 --- a/libio/__fpending.c +++ b/libio/__fpending.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2015 Free Software Foundation, Inc. +/* Copyright (C) 2000-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/libio/__fpurge.c b/libio/__fpurge.c index 065cf61cef..901890f662 100644 --- a/libio/__fpurge.c +++ b/libio/__fpurge.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2015 Free Software Foundation, Inc. +/* Copyright (C) 2000-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/libio/__freadable.c b/libio/__freadable.c index 3d866023cd..41a7168bb8 100644 --- a/libio/__freadable.c +++ b/libio/__freadable.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2015 Free Software Foundation, Inc. +/* Copyright (C) 2000-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/libio/__freading.c b/libio/__freading.c index 7ab0949f35..bc573b1caa 100644 --- a/libio/__freading.c +++ b/libio/__freading.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2015 Free Software Foundation, Inc. +/* Copyright (C) 2000-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/libio/__fsetlocking.c b/libio/__fsetlocking.c index 6ec2b47167..e3122d5589 100644 --- a/libio/__fsetlocking.c +++ b/libio/__fsetlocking.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2015 Free Software Foundation, Inc. +/* Copyright (C) 2000-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/libio/__fwritable.c b/libio/__fwritable.c index 46ee3a5b3e..6ad28a5f6a 100644 --- a/libio/__fwritable.c +++ b/libio/__fwritable.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2015 Free Software Foundation, Inc. +/* Copyright (C) 2000-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/libio/__fwriting.c b/libio/__fwriting.c index 1338051b60..ec0cfd3119 100644 --- a/libio/__fwriting.c +++ b/libio/__fwriting.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2015 Free Software Foundation, Inc. +/* Copyright (C) 2000-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/libio/bits/libio-ldbl.h b/libio/bits/libio-ldbl.h index 5e118c3b37..15c5af9b78 100644 --- a/libio/bits/libio-ldbl.h +++ b/libio/bits/libio-ldbl.h @@ -1,5 +1,5 @@ /* -mlong-double-64 compatibility mode for libio functions. - Copyright (C) 2006-2015 Free Software Foundation, Inc. + Copyright (C) 2006-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/libio/bits/stdio-ldbl.h b/libio/bits/stdio-ldbl.h index ddc2948c0d..d19415ffde 100644 --- a/libio/bits/stdio-ldbl.h +++ b/libio/bits/stdio-ldbl.h @@ -1,5 +1,5 @@ /* -mlong-double-64 compatibility mode for stdio functions. - Copyright (C) 2006-2015 Free Software Foundation, Inc. + Copyright (C) 2006-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/libio/bits/stdio.h b/libio/bits/stdio.h index c3e746bc2b..df57e7c69b 100644 --- a/libio/bits/stdio.h +++ b/libio/bits/stdio.h @@ -1,5 +1,5 @@ /* Optimizing macros and inline functions for stdio functions. - Copyright (C) 1998-2015 Free Software Foundation, Inc. + Copyright (C) 1998-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/libio/bits/stdio2.h b/libio/bits/stdio2.h index 7c50214cf4..fa3be79a66 100644 --- a/libio/bits/stdio2.h +++ b/libio/bits/stdio2.h @@ -1,5 +1,5 @@ /* Checking macros for stdio functions. - Copyright (C) 2004-2015 Free Software Foundation, Inc. + Copyright (C) 2004-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/libio/bug-ungetc4.c b/libio/bug-ungetc4.c index 95fd746ca2..2492734f79 100644 --- a/libio/bug-ungetc4.c +++ b/libio/bug-ungetc4.c @@ -1,5 +1,5 @@ /* Test program for ungetc/fseekpos interaction. - Copyright (C) 2004-2015 Free Software Foundation, Inc. + Copyright (C) 2004-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Jakub Jelinek <jakub@redhat.com>, 2004. diff --git a/libio/clearerr.c b/libio/clearerr.c index 0a52e05ce3..c0fad6d330 100644 --- a/libio/clearerr.c +++ b/libio/clearerr.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1995-2015 Free Software Foundation, Inc. +/* Copyright (C) 1995-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -19,8 +19,7 @@ #include "stdio.h" void -clearerr (fp) - FILE *fp; +clearerr (FILE *fp) { CHECK_FILE (fp, /*nothing*/); _IO_flockfile (fp); diff --git a/libio/clearerr_u.c b/libio/clearerr_u.c index 73b5bc30cf..624ff7a3dc 100644 --- a/libio/clearerr_u.c +++ b/libio/clearerr_u.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1995-2015 Free Software Foundation, Inc. +/* Copyright (C) 1995-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -19,8 +19,7 @@ #include "stdio.h" void -clearerr_unlocked (fp) - FILE *fp; +clearerr_unlocked (FILE *fp) { CHECK_FILE (fp, /*nothing*/); _IO_clearerr (fp); diff --git a/libio/fcloseall.c b/libio/fcloseall.c index d3ed987c2a..1eff772605 100644 --- a/libio/fcloseall.c +++ b/libio/fcloseall.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993-2015 Free Software Foundation, Inc. +/* Copyright (C) 1993-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/libio/feof.c b/libio/feof.c index c89182c288..8de54e6495 100644 --- a/libio/feof.c +++ b/libio/feof.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993-2015 Free Software Foundation, Inc. +/* Copyright (C) 1993-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -28,8 +28,7 @@ #include "stdio.h" int -_IO_feof (fp) - _IO_FILE* fp; +_IO_feof (_IO_FILE *fp) { int result; CHECK_FILE (fp, EOF); diff --git a/libio/feof_u.c b/libio/feof_u.c index 4f552caa9d..9d656e9cf0 100644 --- a/libio/feof_u.c +++ b/libio/feof_u.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993-2015 Free Software Foundation, Inc. +/* Copyright (C) 1993-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -30,8 +30,7 @@ #undef feof_unlocked int -feof_unlocked (fp) - _IO_FILE* fp; +feof_unlocked (_IO_FILE *fp) { CHECK_FILE (fp, EOF); return _IO_feof_unlocked (fp); diff --git a/libio/ferror.c b/libio/ferror.c index 3f73e761d1..daf02f85f4 100644 --- a/libio/ferror.c +++ b/libio/ferror.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993-2015 Free Software Foundation, Inc. +/* Copyright (C) 1993-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -28,8 +28,7 @@ #include "stdio.h" int -_IO_ferror (fp) - _IO_FILE* fp; +_IO_ferror (_IO_FILE *fp) { int result; CHECK_FILE (fp, EOF); diff --git a/libio/ferror_u.c b/libio/ferror_u.c index 08831a0205..7939116c5b 100644 --- a/libio/ferror_u.c +++ b/libio/ferror_u.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993-2015 Free Software Foundation, Inc. +/* Copyright (C) 1993-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -30,8 +30,7 @@ #undef ferror_unlocked int -ferror_unlocked (fp) - _IO_FILE* fp; +ferror_unlocked (_IO_FILE *fp) { CHECK_FILE (fp, EOF); return _IO_ferror_unlocked (fp); diff --git a/libio/filedoalloc.c b/libio/filedoalloc.c index 918a24aa14..b51e910131 100644 --- a/libio/filedoalloc.c +++ b/libio/filedoalloc.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993-2015 Free Software Foundation, Inc. +/* Copyright (C) 1993-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -91,8 +91,7 @@ local_isatty (int fd) */ int -_IO_file_doallocate (fp) - _IO_FILE *fp; +_IO_file_doallocate (_IO_FILE *fp) { _IO_size_t size; char *p; @@ -125,7 +124,9 @@ _IO_file_doallocate (fp) size = st.st_blksize; #endif } - ALLOC_BUF (p, size, EOF); + p = malloc (size); + if (__glibc_unlikely (p == NULL)) + return EOF; _IO_setb (fp, p, p + size, 1); return 1; } diff --git a/libio/fileno.c b/libio/fileno.c index c1b02d5f0d..4a8e91b4b6 100644 --- a/libio/fileno.c +++ b/libio/fileno.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993-2015 Free Software Foundation, Inc. +/* Copyright (C) 1993-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -28,8 +28,7 @@ #include <stdio.h> int -__fileno (fp) - _IO_FILE* fp; +__fileno (_IO_FILE *fp) { CHECK_FILE (fp, EOF); diff --git a/libio/fileops.c b/libio/fileops.c index cbcd6f5353..8e83b1cd7b 100644 --- a/libio/fileops.c +++ b/libio/fileops.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993-2015 Free Software Foundation, Inc. +/* Copyright (C) 1993-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. Written by Per Bothner <bothner@cygnus.com>. diff --git a/libio/fmemopen.c b/libio/fmemopen.c index 3ab3e8dac4..23b5c5fea8 100644 --- a/libio/fmemopen.c +++ b/libio/fmemopen.c @@ -1,5 +1,5 @@ /* fmemopen implementation. - Copyright (C) 2015 Free Software Foundation, Inc. + Copyright (C) 2015-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -149,6 +149,7 @@ __fmemopen (void *buf, size_t len, const char *mode) { cookie_io_functions_t iof; fmemopen_cookie_t *c; + FILE *result; c = (fmemopen_cookie_t *) calloc (sizeof (fmemopen_cookie_t), 1); if (c == NULL) @@ -209,7 +210,16 @@ __fmemopen (void *buf, size_t len, const char *mode) iof.seek = fmemopen_seek; iof.close = fmemopen_close; - return _IO_fopencookie (c, mode, iof); + result = _IO_fopencookie (c, mode, iof); + if (__glibc_unlikely (result == NULL)) + { + if (c->mybuffer) + free (c->buffer); + + free (c); + } + + return result; } libc_hidden_def (__fmemopen) versioned_symbol (libc, __fmemopen, fmemopen, GLIBC_2_22); diff --git a/libio/fputc.c b/libio/fputc.c index 1d52c8042c..261fa2d1b1 100644 --- a/libio/fputc.c +++ b/libio/fputc.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993-2015 Free Software Foundation, Inc. +/* Copyright (C) 1993-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -28,9 +28,7 @@ #include "stdio.h" int -fputc (c, fp) - int c; - _IO_FILE *fp; +fputc (int c, _IO_FILE *fp) { int result; CHECK_FILE (fp, EOF); diff --git a/libio/fputc_u.c b/libio/fputc_u.c index c8c15cafd7..478a2478df 100644 --- a/libio/fputc_u.c +++ b/libio/fputc_u.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993-2015 Free Software Foundation, Inc. +/* Copyright (C) 1993-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -30,9 +30,7 @@ #undef fputc_unlocked int -fputc_unlocked (c, fp) - int c; - _IO_FILE *fp; +fputc_unlocked (int c, _IO_FILE *fp) { CHECK_FILE (fp, EOF); return _IO_putc_unlocked (c, fp); diff --git a/libio/fputwc.c b/libio/fputwc.c index 3781af0d41..1591569059 100644 --- a/libio/fputwc.c +++ b/libio/fputwc.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993-2015 Free Software Foundation, Inc. +/* Copyright (C) 1993-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -28,9 +28,7 @@ #include <wchar.h> wint_t -fputwc (wc, fp) - wchar_t wc; - _IO_FILE *fp; +fputwc (wchar_t wc, _IO_FILE *fp) { wint_t result; CHECK_FILE (fp, EOF); diff --git a/libio/fputwc_u.c b/libio/fputwc_u.c index 86e10590d2..3a92b4fa6d 100644 --- a/libio/fputwc_u.c +++ b/libio/fputwc_u.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993-2015 Free Software Foundation, Inc. +/* Copyright (C) 1993-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -30,9 +30,7 @@ #undef fputwc_unlocked wint_t -fputwc_unlocked (wc, fp) - wchar_t wc; - _IO_FILE *fp; +fputwc_unlocked (wchar_t wc, _IO_FILE *fp) { CHECK_FILE (fp, WEOF); if (_IO_fwide (fp, 1) < 0) diff --git a/libio/freopen.c b/libio/freopen.c index 035fa1fa79..8a2a417068 100644 --- a/libio/freopen.c +++ b/libio/freopen.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993-2015 Free Software Foundation, Inc. +/* Copyright (C) 1993-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -35,11 +35,8 @@ #include <kernel-features.h> -FILE* -freopen (filename, mode, fp) - const char* filename; - const char* mode; - FILE* fp; +FILE * +freopen (const char *filename, const char *mode, FILE *fp) { FILE *result; CHECK_FILE (fp, NULL); diff --git a/libio/freopen64.c b/libio/freopen64.c index fc6ccb12f0..ba85c3ea4f 100644 --- a/libio/freopen64.c +++ b/libio/freopen64.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993-2015 Free Software Foundation, Inc. +/* Copyright (C) 1993-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -35,10 +35,7 @@ #include <kernel-features.h> FILE * -freopen64 (filename, mode, fp) - const char* filename; - const char* mode; - FILE *fp; +freopen64 (const char *filename, const char *mode, FILE *fp) { FILE *result; CHECK_FILE (fp, NULL); diff --git a/libio/fseek.c b/libio/fseek.c index 1ee89bac1e..a8d677048f 100644 --- a/libio/fseek.c +++ b/libio/fseek.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993-2015 Free Software Foundation, Inc. +/* Copyright (C) 1993-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -28,10 +28,7 @@ #include <stdio.h> int -fseek (fp, offset, whence) - _IO_FILE* fp; - long int offset; - int whence; +fseek (_IO_FILE *fp, long int offset, int whence) { int result; CHECK_FILE (fp, -1); diff --git a/libio/fseeko.c b/libio/fseeko.c index 304bb423df..288a48b94e 100644 --- a/libio/fseeko.c +++ b/libio/fseeko.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993-2015 Free Software Foundation, Inc. +/* Copyright (C) 1993-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -28,10 +28,7 @@ #include "stdio.h" int -fseeko (fp, offset, whence) - _IO_FILE* fp; - off_t offset; - int whence; +fseeko (_IO_FILE *fp, off_t offset, int whence) { int result; CHECK_FILE (fp, -1); diff --git a/libio/fseeko64.c b/libio/fseeko64.c index 8dc57cb579..068bf4e871 100644 --- a/libio/fseeko64.c +++ b/libio/fseeko64.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993-2015 Free Software Foundation, Inc. +/* Copyright (C) 1993-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -32,10 +32,7 @@ #ifndef __OFF_T_MATCHES_OFF64_T int -fseeko64 (fp, offset, whence) - _IO_FILE* fp; - __off64_t offset; - int whence; +fseeko64 (_IO_FILE *fp, __off64_t offset, int whence) { int result; CHECK_FILE (fp, -1); diff --git a/libio/ftello.c b/libio/ftello.c index fc56f7c601..7122815f2e 100644 --- a/libio/ftello.c +++ b/libio/ftello.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993-2015 Free Software Foundation, Inc. +/* Copyright (C) 1993-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -31,8 +31,7 @@ off_t -__ftello (fp) - _IO_FILE *fp; +__ftello (_IO_FILE *fp) { _IO_off64_t pos; CHECK_FILE (fp, -1L); diff --git a/libio/ftello64.c b/libio/ftello64.c index 998fc15e25..534968cf9f 100644 --- a/libio/ftello64.c +++ b/libio/ftello64.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993-2015 Free Software Foundation, Inc. +/* Copyright (C) 1993-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -32,8 +32,7 @@ #ifndef __OFF_T_MATCHES_OFF64_T off64_t -ftello64 (fp) - _IO_FILE *fp; +ftello64 (_IO_FILE *fp) { _IO_off64_t pos; CHECK_FILE (fp, -1L); diff --git a/libio/fwide.c b/libio/fwide.c index 1a93e74c2e..b9dceeaf22 100644 --- a/libio/fwide.c +++ b/libio/fwide.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1999-2015 Free Software Foundation, Inc. +/* Copyright (C) 1999-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -29,9 +29,7 @@ #include <wchar.h> int -fwide (fp, mode) - _IO_FILE *fp; - int mode; +fwide (_IO_FILE *fp, int mode) { int result; diff --git a/libio/fwprintf.c b/libio/fwprintf.c index 64413b82c5..8a8903b187 100644 --- a/libio/fwprintf.c +++ b/libio/fwprintf.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2015 Free Software Foundation, Inc. +/* Copyright (C) 1991-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/libio/fwscanf.c b/libio/fwscanf.c index b379b88081..b61db7b316 100644 --- a/libio/fwscanf.c +++ b/libio/fwscanf.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2015 Free Software Foundation, Inc. +/* Copyright (C) 1991-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/libio/genops.c b/libio/genops.c index 0f5e80064e..5803cbf04f 100644 --- a/libio/genops.c +++ b/libio/genops.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993-2015 Free Software Foundation, Inc. +/* Copyright (C) 1993-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -55,8 +55,7 @@ flush_cleanup (void *not_used) #endif void -_IO_un_link (fp) - struct _IO_FILE_plus *fp; +_IO_un_link (struct _IO_FILE_plus *fp) { if (fp->file._flags & _IO_LINKED) { @@ -94,8 +93,7 @@ _IO_un_link (fp) libc_hidden_def (_IO_un_link) void -_IO_link_in (fp) - struct _IO_FILE_plus *fp; +_IO_link_in (struct _IO_FILE_plus *fp) { if ((fp->file._flags & _IO_LINKED) == 0) { @@ -124,9 +122,7 @@ libc_hidden_def (_IO_link_in) _IO_ssize_t _IO_least_marker (_IO_FILE *fp, char *end_p); _IO_ssize_t -_IO_least_marker (fp, end_p) - _IO_FILE *fp; - char *end_p; +_IO_least_marker (_IO_FILE *fp, char *end_p) { _IO_ssize_t least_so_far = end_p - fp->_IO_read_base; struct _IO_marker *mark; @@ -139,8 +135,7 @@ _IO_least_marker (fp, end_p) /* Switch current get area from backup buffer to (start of) main get area. */ void -_IO_switch_to_main_get_area (fp) - _IO_FILE *fp; +_IO_switch_to_main_get_area (_IO_FILE *fp) { char *tmp; fp->_flags &= ~_IO_IN_BACKUP; @@ -159,8 +154,7 @@ _IO_switch_to_main_get_area (fp) /* Switch current get area from main get area to (end of) backup area. */ void -_IO_switch_to_backup_area (fp) - _IO_FILE *fp; +_IO_switch_to_backup_area (_IO_FILE *fp) { char *tmp; fp->_flags |= _IO_IN_BACKUP; @@ -177,8 +171,7 @@ _IO_switch_to_backup_area (fp) } int -_IO_switch_to_get_mode (fp) - _IO_FILE *fp; +_IO_switch_to_get_mode (_IO_FILE *fp) { if (fp->_IO_write_ptr > fp->_IO_write_base) if (_IO_OVERFLOW (fp, EOF) == EOF) @@ -201,8 +194,7 @@ _IO_switch_to_get_mode (fp) libc_hidden_def (_IO_switch_to_get_mode) void -_IO_free_backup_area (fp) - _IO_FILE *fp; +_IO_free_backup_area (_IO_FILE *fp) { if (_IO_in_backup (fp)) _IO_switch_to_main_get_area (fp); /* Just in case. */ @@ -215,8 +207,7 @@ libc_hidden_def (_IO_free_backup_area) #if 0 int -_IO_switch_to_put_mode (fp) - _IO_FILE *fp; +_IO_switch_to_put_mode (_IO_FILE *fp) { fp->_IO_write_base = fp->_IO_read_ptr; fp->_IO_write_ptr = fp->_IO_read_ptr; @@ -233,9 +224,7 @@ _IO_switch_to_put_mode (fp) #endif int -__overflow (f, ch) - _IO_FILE *f; - int ch; +__overflow (_IO_FILE *f, int ch) { /* This is a single-byte stream. */ if (f->_mode == 0) @@ -254,9 +243,7 @@ static int #ifdef _LIBC internal_function #endif -save_for_backup (fp, end_p) - _IO_FILE *fp; - char *end_p; +save_for_backup (_IO_FILE *fp, char *end_p) { /* Append [_IO_read_base..end_p] to backup area. */ _IO_ssize_t least_mark = _IO_least_marker (fp, end_p); @@ -325,8 +312,7 @@ save_for_backup (fp, end_p) } int -__underflow (fp) - _IO_FILE *fp; +__underflow (_IO_FILE *fp) { #if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T if (_IO_vtable_offset (fp) == 0 && _IO_fwide (fp, -1) != -1) @@ -358,8 +344,7 @@ __underflow (fp) libc_hidden_def (__underflow) int -__uflow (fp) - _IO_FILE *fp; +__uflow (_IO_FILE *fp) { #if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T if (_IO_vtable_offset (fp) == 0 && _IO_fwide (fp, -1) != -1) @@ -391,14 +376,10 @@ __uflow (fp) libc_hidden_def (__uflow) void -_IO_setb (f, b, eb, a) - _IO_FILE *f; - char *b; - char *eb; - int a; +_IO_setb (_IO_FILE *f, char *b, char *eb, int a) { if (f->_IO_buf_base && !(f->_flags & _IO_USER_BUF)) - FREE_BUF (f->_IO_buf_base, _IO_blen (f)); + free (f->_IO_buf_base); f->_IO_buf_base = b; f->_IO_buf_end = eb; if (a) @@ -409,8 +390,7 @@ _IO_setb (f, b, eb, a) libc_hidden_def (_IO_setb) void -_IO_doallocbuf (fp) - _IO_FILE *fp; +_IO_doallocbuf (_IO_FILE *fp) { if (fp->_IO_buf_base) return; @@ -422,15 +402,13 @@ _IO_doallocbuf (fp) libc_hidden_def (_IO_doallocbuf) int -_IO_default_underflow (fp) - _IO_FILE *fp; +_IO_default_underflow (_IO_FILE *fp) { return EOF; } int -_IO_default_uflow (fp) - _IO_FILE *fp; +_IO_default_uflow (_IO_FILE *fp) { int ch = _IO_UNDERFLOW (fp); if (ch == EOF) @@ -440,10 +418,7 @@ _IO_default_uflow (fp) libc_hidden_def (_IO_default_uflow) _IO_size_t -_IO_default_xsputn (f, data, n) - _IO_FILE *f; - const void *data; - _IO_size_t n; +_IO_default_xsputn (_IO_FILE *f, const void *data, _IO_size_t n) { const char *s = (char *) data; _IO_size_t more = n; @@ -486,10 +461,7 @@ _IO_default_xsputn (f, data, n) libc_hidden_def (_IO_default_xsputn) _IO_size_t -_IO_sgetn (fp, data, n) - _IO_FILE *fp; - void *data; - _IO_size_t n; +_IO_sgetn (_IO_FILE *fp, void *data, _IO_size_t n) { /* FIXME handle putback buffer here! */ return _IO_XSGETN (fp, data, n); @@ -497,10 +469,7 @@ _IO_sgetn (fp, data, n) libc_hidden_def (_IO_sgetn) _IO_size_t -_IO_default_xsgetn (fp, data, n) - _IO_FILE *fp; - void *data; - _IO_size_t n; +_IO_default_xsgetn (_IO_FILE *fp, void *data, _IO_size_t n) { _IO_size_t more = n; char *s = (char*) data; @@ -542,18 +511,14 @@ libc_hidden_def (_IO_default_xsgetn) #if 0 /* Seems not to be needed. --drepper */ int -_IO_sync (fp) - _IO_FILE *fp; +_IO_sync (_IO_FILE *fp) { return 0; } #endif _IO_FILE * -_IO_default_setbuf (fp, p, len) - _IO_FILE *fp; - char *p; - _IO_ssize_t len; +_IO_default_setbuf (_IO_FILE *fp, char *p, _IO_ssize_t len) { if (_IO_SYNC (fp) == EOF) return NULL; @@ -573,39 +538,34 @@ _IO_default_setbuf (fp, p, len) } _IO_off64_t -_IO_default_seekpos (fp, pos, mode) - _IO_FILE *fp; - _IO_off64_t pos; - int mode; +_IO_default_seekpos (_IO_FILE *fp, _IO_off64_t pos, int mode) { return _IO_SEEKOFF (fp, pos, 0, mode); } int -_IO_default_doallocate (fp) - _IO_FILE *fp; +_IO_default_doallocate (_IO_FILE *fp) { char *buf; - ALLOC_BUF (buf, _IO_BUFSIZ, EOF); + buf = malloc(_IO_BUFSIZ); + if (__glibc_unlikely (buf == NULL)) + return EOF; + _IO_setb (fp, buf, buf+_IO_BUFSIZ, 1); return 1; } libc_hidden_def (_IO_default_doallocate) void -_IO_init (fp, flags) - _IO_FILE *fp; - int flags; +_IO_init (_IO_FILE *fp, int flags) { _IO_no_init (fp, flags, -1, NULL, NULL); } libc_hidden_def (_IO_init) void -_IO_old_init (fp, flags) - _IO_FILE *fp; - int flags; +_IO_old_init (_IO_FILE *fp, int flags) { fp->_flags = _IO_MAGIC|flags; fp->_flags2 = 0; @@ -634,12 +594,8 @@ _IO_old_init (fp, flags) } void -_IO_no_init (fp, flags, orientation, wd, jmp) - _IO_FILE *fp; - int flags; - int orientation; - struct _IO_wide_data *wd; - const struct _IO_jump_t *jmp; +_IO_no_init (_IO_FILE *fp, int flags, int orientation, + struct _IO_wide_data *wd, const struct _IO_jump_t *jmp) { _IO_old_init (fp, flags); fp->_mode = orientation; @@ -670,8 +626,7 @@ _IO_no_init (fp, flags, orientation, wd, jmp) } int -_IO_default_sync (fp) - _IO_FILE *fp; +_IO_default_sync (_IO_FILE *fp) { return 0; } @@ -680,14 +635,12 @@ _IO_default_sync (fp) current implementation, this function can get called twice! */ void -_IO_default_finish (fp, dummy) - _IO_FILE *fp; - int dummy; +_IO_default_finish (_IO_FILE *fp, int dummy) { struct _IO_marker *mark; if (fp->_IO_buf_base && !(fp->_flags & _IO_USER_BUF)) { - FREE_BUF (fp->_IO_buf_base, _IO_blen (fp)); + free (fp->_IO_buf_base); fp->_IO_buf_base = fp->_IO_buf_end = NULL; } @@ -710,19 +663,13 @@ _IO_default_finish (fp, dummy) libc_hidden_def (_IO_default_finish) _IO_off64_t -_IO_default_seekoff (fp, offset, dir, mode) - _IO_FILE *fp; - _IO_off64_t offset; - int dir; - int mode; +_IO_default_seekoff (_IO_FILE *fp, _IO_off64_t offset, int dir, int mode) { return _IO_pos_BAD; } int -_IO_sputbackc (fp, c) - _IO_FILE *fp; - int c; +_IO_sputbackc (_IO_FILE *fp, int c) { int result; @@ -743,8 +690,7 @@ _IO_sputbackc (fp, c) libc_hidden_def (_IO_sputbackc) int -_IO_sungetc (fp) - _IO_FILE *fp; +_IO_sungetc (_IO_FILE *fp) { int result; @@ -766,9 +712,7 @@ _IO_sungetc (fp) /* Seems not to be needed. */ #if 0 void -_IO_set_column (fp, c) - _IO_FILE *fp; - int c; +_IO_set_column (_IO_FILE *fp, int c) { if (c == -1) fp->_column = -1; @@ -777,9 +721,7 @@ _IO_set_column (fp, c) } #else int -_IO_set_column (fp, i) - _IO_FILE *fp; - int i; +_IO_set_column (_IO_FILE *fp, int i) { fp->_cur_column = i + 1; return 0; @@ -789,10 +731,7 @@ _IO_set_column (fp, i) unsigned -_IO_adjust_column (start, line, count) - unsigned start; - const char *line; - int count; +_IO_adjust_column (unsigned start, const char *line, int count) { const char *ptr = line + count; while (ptr > line) @@ -805,8 +744,7 @@ libc_hidden_def (_IO_adjust_column) #if 0 /* Seems not to be needed. --drepper */ int -_IO_get_column (fp) - _IO_FILE *fp; +_IO_get_column (_IO_FILE *fp) { if (fp->_cur_column) return _IO_adjust_column (fp->_cur_column - 1, @@ -972,11 +910,13 @@ _IO_unbuffer_all (void) fp->_freeres_list = freeres_list; freeres_list = fp; fp->_freeres_buf = fp->_IO_buf_base; - fp->_freeres_size = _IO_blen (fp); } _IO_SETBUF (fp, NULL, 0); + if (fp->_mode > 0) + _IO_wsetb (fp, NULL, NULL, 0); + #ifdef _IO_MTSAFE_IO if (cnt < MAXTRIES && fp->_lock != NULL) _IO_lock_unlock (*fp->_lock); @@ -996,7 +936,7 @@ libc_freeres_fn (buffer_free) while (freeres_list != NULL) { - FREE_BUF (freeres_list->_freeres_buf, freeres_list->_freeres_size); + free (freeres_list->_freeres_buf); freeres_list = freeres_list->_freeres_list; } @@ -1024,9 +964,7 @@ _IO_cleanup (void) void -_IO_init_marker (marker, fp) - struct _IO_marker *marker; - _IO_FILE *fp; +_IO_init_marker (struct _IO_marker *marker, _IO_FILE *fp) { marker->_sbuf = fp; if (_IO_in_put_mode (fp)) @@ -1042,8 +980,7 @@ _IO_init_marker (marker, fp) } void -_IO_remove_marker (marker) - struct _IO_marker *marker; +_IO_remove_marker (struct _IO_marker *marker) { /* Unlink from sb's chain. */ struct _IO_marker **ptr = &marker->_sbuf->_markers; @@ -1066,17 +1003,14 @@ _IO_remove_marker (marker) #define BAD_DELTA EOF int -_IO_marker_difference (mark1, mark2) - struct _IO_marker *mark1; - struct _IO_marker *mark2; +_IO_marker_difference (struct _IO_marker *mark1, struct _IO_marker *mark2) { return mark1->_pos - mark2->_pos; } /* Return difference between MARK and current position of MARK's stream. */ int -_IO_marker_delta (mark) - struct _IO_marker *mark; +_IO_marker_delta (struct _IO_marker *mark) { int cur_pos; if (mark->_sbuf == NULL) @@ -1089,10 +1023,7 @@ _IO_marker_delta (mark) } int -_IO_seekmark (fp, mark, delta) - _IO_FILE *fp; - struct _IO_marker *mark; - int delta; +_IO_seekmark (_IO_FILE *fp, struct _IO_marker *mark, int delta) { if (mark->_sbuf != fp) return EOF; @@ -1112,8 +1043,7 @@ _IO_seekmark (fp, mark, delta) } void -_IO_unsave_markers (fp) - _IO_FILE *fp; +_IO_unsave_markers (_IO_FILE *fp) { struct _IO_marker *mark = fp->_markers; if (mark) @@ -1143,9 +1073,7 @@ libc_hidden_def (_IO_unsave_markers) #if 0 /* Seems not to be needed. --drepper */ int -_IO_nobackup_pbackfail (fp, c) - _IO_FILE *fp; - int c; +_IO_nobackup_pbackfail (_IO_FILE *fp, int c) { if (fp->_IO_read_ptr > fp->_IO_read_base) fp->_IO_read_ptr--; @@ -1156,9 +1084,7 @@ _IO_nobackup_pbackfail (fp, c) #endif int -_IO_default_pbackfail (fp, c) - _IO_FILE *fp; - int c; +_IO_default_pbackfail (_IO_FILE *fp, int c) { if (fp->_IO_read_ptr > fp->_IO_read_base && !_IO_in_backup (fp) && (unsigned char) fp->_IO_read_ptr[-1] == c) @@ -1215,51 +1141,37 @@ _IO_default_pbackfail (fp, c) libc_hidden_def (_IO_default_pbackfail) _IO_off64_t -_IO_default_seek (fp, offset, dir) - _IO_FILE *fp; - _IO_off64_t offset; - int dir; +_IO_default_seek (_IO_FILE *fp, _IO_off64_t offset, int dir) { return _IO_pos_BAD; } int -_IO_default_stat (fp, st) - _IO_FILE *fp; - void* st; +_IO_default_stat (_IO_FILE *fp, void *st) { return EOF; } _IO_ssize_t -_IO_default_read (fp, data, n) - _IO_FILE* fp; - void *data; - _IO_ssize_t n; +_IO_default_read (_IO_FILE *fp, void *data, _IO_ssize_t n) { return -1; } _IO_ssize_t -_IO_default_write (fp, data, n) - _IO_FILE *fp; - const void *data; - _IO_ssize_t n; +_IO_default_write (_IO_FILE *fp, const void *data, _IO_ssize_t n) { return 0; } int -_IO_default_showmanyc (fp) - _IO_FILE *fp; +_IO_default_showmanyc (_IO_FILE *fp) { return -1; } void -_IO_default_imbue (fp, locale) - _IO_FILE *fp; - void *locale; +_IO_default_imbue (_IO_FILE *fp, void *locale) { } @@ -1278,16 +1190,14 @@ _IO_iter_end (void) libc_hidden_def (_IO_iter_end) _IO_ITER -_IO_iter_next(iter) - _IO_ITER iter; +_IO_iter_next (_IO_ITER iter) { return iter->_chain; } libc_hidden_def (_IO_iter_next) _IO_FILE * -_IO_iter_file(iter) - _IO_ITER iter; +_IO_iter_file (_IO_ITER iter) { return iter; } diff --git a/libio/getc.c b/libio/getc.c index 270c47a660..434367c7e5 100644 --- a/libio/getc.c +++ b/libio/getc.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993-2015 Free Software Foundation, Inc. +/* Copyright (C) 1993-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -30,8 +30,7 @@ #undef _IO_getc int -_IO_getc (fp) - FILE *fp; +_IO_getc (FILE *fp) { int result; CHECK_FILE (fp, EOF); diff --git a/libio/getc_u.c b/libio/getc_u.c index 1e29e5c62c..7567670b56 100644 --- a/libio/getc_u.c +++ b/libio/getc_u.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993-2015 Free Software Foundation, Inc. +/* Copyright (C) 1993-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/libio/getchar.c b/libio/getchar.c index 7ca3318fd1..db1b6e3698 100644 --- a/libio/getchar.c +++ b/libio/getchar.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993-2015 Free Software Foundation, Inc. +/* Copyright (C) 1993-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/libio/getchar_u.c b/libio/getchar_u.c index 15cf56eb6b..de158ac895 100644 --- a/libio/getchar_u.c +++ b/libio/getchar_u.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993-2015 Free Software Foundation, Inc. +/* Copyright (C) 1993-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/libio/getwc.c b/libio/getwc.c index a6e8fd7e97..dc41d71fc2 100644 --- a/libio/getwc.c +++ b/libio/getwc.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993-2015 Free Software Foundation, Inc. +/* Copyright (C) 1993-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -31,8 +31,7 @@ #undef _IO_getwc wint_t -_IO_getwc (fp) - FILE *fp; +_IO_getwc (FILE *fp) { wint_t result; CHECK_FILE (fp, WEOF); diff --git a/libio/getwc_u.c b/libio/getwc_u.c index d3fa2794c9..2f8682fea7 100644 --- a/libio/getwc_u.c +++ b/libio/getwc_u.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993-2015 Free Software Foundation, Inc. +/* Copyright (C) 1993-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/libio/getwchar.c b/libio/getwchar.c index 1314fb4367..03df4755eb 100644 --- a/libio/getwchar.c +++ b/libio/getwchar.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993-2015 Free Software Foundation, Inc. +/* Copyright (C) 1993-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/libio/getwchar_u.c b/libio/getwchar_u.c index 0124048565..e7f17777cb 100644 --- a/libio/getwchar_u.c +++ b/libio/getwchar_u.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993-2015 Free Software Foundation, Inc. +/* Copyright (C) 1993-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/libio/iofclose.c b/libio/iofclose.c index 3281e3f41b..33b130eb25 100644 --- a/libio/iofclose.c +++ b/libio/iofclose.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993-2015 Free Software Foundation, Inc. +/* Copyright (C) 1993-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -35,8 +35,7 @@ #endif int -_IO_new_fclose (fp) - _IO_FILE *fp; +_IO_new_fclose (_IO_FILE *fp) { int status; diff --git a/libio/iofdopen.c b/libio/iofdopen.c index e7d84ae983..e00f337521 100644 --- a/libio/iofdopen.c +++ b/libio/iofdopen.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993-2015 Free Software Foundation, Inc. +/* Copyright (C) 1993-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -41,9 +41,7 @@ #endif _IO_FILE * -_IO_new_fdopen (fd, mode) - int fd; - const char *mode; +_IO_new_fdopen (int fd, const char *mode) { int read_write; struct locked_FILE diff --git a/libio/iofflush.c b/libio/iofflush.c index 236e145a91..f81bc339f1 100644 --- a/libio/iofflush.c +++ b/libio/iofflush.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993-2015 Free Software Foundation, Inc. +/* Copyright (C) 1993-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -28,8 +28,7 @@ #include <stdio.h> int -_IO_fflush (fp) - _IO_FILE *fp; +_IO_fflush (_IO_FILE *fp) { if (fp == NULL) return _IO_flush_all (); diff --git a/libio/iofflush_u.c b/libio/iofflush_u.c index e00447991d..ad5b122bc5 100644 --- a/libio/iofflush_u.c +++ b/libio/iofflush_u.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993-2015 Free Software Foundation, Inc. +/* Copyright (C) 1993-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -28,8 +28,7 @@ #include <stdio.h> int -__fflush_unlocked (fp) - _IO_FILE *fp; +__fflush_unlocked (_IO_FILE *fp) { if (fp == NULL) return _IO_flush_all (); diff --git a/libio/iofgetpos.c b/libio/iofgetpos.c index 8f900d517a..70b3a6d33f 100644 --- a/libio/iofgetpos.c +++ b/libio/iofgetpos.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993-2015 Free Software Foundation, Inc. +/* Copyright (C) 1993-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -40,9 +40,7 @@ #include <shlib-compat.h> int -_IO_new_fgetpos (fp, posp) - _IO_FILE *fp; - _IO_fpos_t *posp; +_IO_new_fgetpos (_IO_FILE *fp, _IO_fpos_t *posp) { _IO_off64_t pos; int result = 0; diff --git a/libio/iofgetpos64.c b/libio/iofgetpos64.c index 71b0d6492c..563d075cdc 100644 --- a/libio/iofgetpos64.c +++ b/libio/iofgetpos64.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993-2015 Free Software Foundation, Inc. +/* Copyright (C) 1993-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -31,9 +31,7 @@ #ifndef __OFF_T_MATCHES_OFF64_T int -_IO_new_fgetpos64 (fp, posp) - _IO_FILE *fp; - _IO_fpos64_t *posp; +_IO_new_fgetpos64 (_IO_FILE *fp, _IO_fpos64_t *posp) { _IO_off64_t pos; int result = 0; diff --git a/libio/iofgets.c b/libio/iofgets.c index f001b623f6..6fd86eac75 100644 --- a/libio/iofgets.c +++ b/libio/iofgets.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993-2015 Free Software Foundation, Inc. +/* Copyright (C) 1993-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -28,10 +28,7 @@ #include <stdio.h> char * -_IO_fgets (buf, n, fp) - char *buf; - int n; - _IO_FILE *fp; +_IO_fgets (char *buf, int n, _IO_FILE *fp) { _IO_size_t count; char *result; diff --git a/libio/iofgets_u.c b/libio/iofgets_u.c index f6acf646d7..e4705ffb05 100644 --- a/libio/iofgets_u.c +++ b/libio/iofgets_u.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993-2015 Free Software Foundation, Inc. +/* Copyright (C) 1993-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -28,10 +28,7 @@ #include <stdio.h> char * -__fgets_unlocked (buf, n, fp) - char *buf; - int n; - _IO_FILE *fp; +__fgets_unlocked (char *buf, int n, _IO_FILE *fp) { _IO_size_t count; char *result; diff --git a/libio/iofgetws.c b/libio/iofgetws.c index a18fb3d5c0..7a61d8c675 100644 --- a/libio/iofgetws.c +++ b/libio/iofgetws.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993-2015 Free Software Foundation, Inc. +/* Copyright (C) 1993-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -28,10 +28,7 @@ #include <wchar.h> wchar_t * -fgetws (buf, n, fp) - wchar_t *buf; - int n; - _IO_FILE *fp; +fgetws (wchar_t *buf, int n, _IO_FILE *fp) { _IO_size_t count; wchar_t *result; diff --git a/libio/iofgetws_u.c b/libio/iofgetws_u.c index 6717978958..eafc45e469 100644 --- a/libio/iofgetws_u.c +++ b/libio/iofgetws_u.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993-2015 Free Software Foundation, Inc. +/* Copyright (C) 1993-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -28,10 +28,7 @@ #include <wchar.h> wchar_t * -fgetws_unlocked (buf, n, fp) - wchar_t *buf; - int n; - _IO_FILE *fp; +fgetws_unlocked (wchar_t *buf, int n, _IO_FILE *fp) { _IO_size_t count; wchar_t *result; diff --git a/libio/iofopen.c b/libio/iofopen.c index be2bbb663b..13e3910b63 100644 --- a/libio/iofopen.c +++ b/libio/iofopen.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993-2015 Free Software Foundation, Inc. +/* Copyright (C) 1993-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/libio/iofopen64.c b/libio/iofopen64.c index 89f13aa9ae..daf722432d 100644 --- a/libio/iofopen64.c +++ b/libio/iofopen64.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993-2015 Free Software Foundation, Inc. +/* Copyright (C) 1993-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -32,9 +32,7 @@ #if !defined _LIBC || (defined O_LARGEFILE && O_LARGEFILE != 0) _IO_FILE * -_IO_fopen64 (filename, mode) - const char *filename; - const char *mode; +_IO_fopen64 (const char *filename, const char *mode) { return __fopen_internal (filename, mode, 0); } diff --git a/libio/iofopncook.c b/libio/iofopncook.c index b845d29657..9eda7c1eaa 100644 --- a/libio/iofopncook.c +++ b/libio/iofopncook.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993-2015 Free Software Foundation, Inc. +/* Copyright (C) 1993-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -40,10 +40,7 @@ static _IO_off64_t _IO_cookie_seekoff (_IO_FILE *fp, _IO_off64_t offset, static int _IO_cookie_close (_IO_FILE* fp); static _IO_ssize_t -_IO_cookie_read (fp, buf, size) - _IO_FILE *fp; - void *buf; - _IO_ssize_t size; +_IO_cookie_read (_IO_FILE *fp, void *buf, _IO_ssize_t size) { struct _IO_cookie_file *cfile = (struct _IO_cookie_file *) fp; @@ -54,10 +51,7 @@ _IO_cookie_read (fp, buf, size) } static _IO_ssize_t -_IO_cookie_write (fp, buf, size) - _IO_FILE *fp; - const void *buf; - _IO_ssize_t size; +_IO_cookie_write (_IO_FILE *fp, const void *buf, _IO_ssize_t size) { struct _IO_cookie_file *cfile = (struct _IO_cookie_file *) fp; @@ -75,10 +69,7 @@ _IO_cookie_write (fp, buf, size) } static _IO_off64_t -_IO_cookie_seek (fp, offset, dir) - _IO_FILE *fp; - _IO_off64_t offset; - int dir; +_IO_cookie_seek (_IO_FILE *fp, _IO_off64_t offset, int dir) { struct _IO_cookie_file *cfile = (struct _IO_cookie_file *) fp; @@ -90,8 +81,7 @@ _IO_cookie_seek (fp, offset, dir) } static int -_IO_cookie_close (fp) - _IO_FILE *fp; +_IO_cookie_close (_IO_FILE *fp) { struct _IO_cookie_file *cfile = (struct _IO_cookie_file *) fp; @@ -103,11 +93,7 @@ _IO_cookie_close (fp) static _IO_off64_t -_IO_cookie_seekoff (fp, offset, dir, mode) - _IO_FILE *fp; - _IO_off64_t offset; - int dir; - int mode; +_IO_cookie_seekoff (_IO_FILE *fp, _IO_off64_t offset, int dir, int mode) { /* We must force the fileops code to always use seek to determine the position. */ @@ -163,10 +149,8 @@ _IO_cookie_init (struct _IO_cookie_file *cfile, int read_write, _IO_FILE * -_IO_fopencookie (cookie, mode, io_functions) - void *cookie; - const char *mode; - _IO_cookie_io_functions_t io_functions; +_IO_fopencookie (void *cookie, const char *mode, + _IO_cookie_io_functions_t io_functions) { int read_write; struct locked_FILE @@ -189,6 +173,7 @@ _IO_fopencookie (cookie, mode, io_functions) read_write = _IO_NO_READS|_IO_IS_APPENDING; break; default: + __set_errno (EINVAL); return NULL; } if (mode[0] == '+' || (mode[0] == 'b' && mode[1] == '+')) @@ -217,10 +202,7 @@ _IO_FILE * _IO_old_fopencookie (void *cookie, const char *mode, static _IO_off64_t attribute_compat_text_section -_IO_old_cookie_seek (fp, offset, dir) - _IO_FILE *fp; - _IO_off64_t offset; - int dir; +_IO_old_cookie_seek (_IO_FILE *fp, _IO_off64_t offset, int dir) { struct _IO_cookie_file *cfile = (struct _IO_cookie_file *) fp; int (*seek) (_IO_FILE *, _IO_off_t, int); @@ -260,10 +242,8 @@ static const struct _IO_jump_t _IO_old_cookie_jumps = { _IO_FILE * attribute_compat_text_section -_IO_old_fopencookie (cookie, mode, io_functions) - void *cookie; - const char *mode; - _IO_cookie_io_functions_t io_functions; +_IO_old_fopencookie (void *cookie, const char *mode, + _IO_cookie_io_functions_t io_functions) { _IO_FILE *ret; diff --git a/libio/iofputs.c b/libio/iofputs.c index d1e34e40b4..4868ce40d9 100644 --- a/libio/iofputs.c +++ b/libio/iofputs.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993-2015 Free Software Foundation, Inc. +/* Copyright (C) 1993-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -28,9 +28,7 @@ #include <string.h> int -_IO_fputs (str, fp) - const char *str; - _IO_FILE *fp; +_IO_fputs (const char *str, _IO_FILE *fp) { _IO_size_t len = strlen (str); int result = EOF; diff --git a/libio/iofputs_u.c b/libio/iofputs_u.c index f823686d5b..9997dfc38f 100644 --- a/libio/iofputs_u.c +++ b/libio/iofputs_u.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993-2015 Free Software Foundation, Inc. +/* Copyright (C) 1993-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -29,9 +29,7 @@ #include <string.h> int -__fputs_unlocked (str, fp) - const char *str; - _IO_FILE *fp; +__fputs_unlocked (const char *str, _IO_FILE *fp) { _IO_size_t len = strlen (str); int result = EOF; diff --git a/libio/iofputws.c b/libio/iofputws.c index 4c59a3aa52..de67ce0fa1 100644 --- a/libio/iofputws.c +++ b/libio/iofputws.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993-2015 Free Software Foundation, Inc. +/* Copyright (C) 1993-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -28,9 +28,7 @@ #include <wchar.h> int -fputws (str, fp) - const wchar_t *str; - _IO_FILE *fp; +fputws (const wchar_t *str, _IO_FILE *fp) { _IO_size_t len = __wcslen (str); int result = EOF; diff --git a/libio/iofputws_u.c b/libio/iofputws_u.c index 092aeb4c01..aa8fb8a484 100644 --- a/libio/iofputws_u.c +++ b/libio/iofputws_u.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993-2015 Free Software Foundation, Inc. +/* Copyright (C) 1993-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -29,9 +29,7 @@ #include <wchar.h> int -fputws_unlocked (str, fp) - const wchar_t *str; - _IO_FILE *fp; +fputws_unlocked (const wchar_t *str, _IO_FILE *fp) { _IO_size_t len = __wcslen (str); int result = EOF; diff --git a/libio/iofread.c b/libio/iofread.c index 817df76d9f..80ed3e7ebd 100644 --- a/libio/iofread.c +++ b/libio/iofread.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993-2015 Free Software Foundation, Inc. +/* Copyright (C) 1993-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -27,11 +27,7 @@ #include "libioP.h" _IO_size_t -_IO_fread (buf, size, count, fp) - void *buf; - _IO_size_t size; - _IO_size_t count; - _IO_FILE *fp; +_IO_fread (void *buf, _IO_size_t size, _IO_size_t count, _IO_FILE *fp) { _IO_size_t bytes_requested = size * count; _IO_size_t bytes_read; diff --git a/libio/iofread_u.c b/libio/iofread_u.c index ba0bc3e39c..25bea32a44 100644 --- a/libio/iofread_u.c +++ b/libio/iofread_u.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993-2015 Free Software Foundation, Inc. +/* Copyright (C) 1993-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -30,11 +30,7 @@ #undef fread_unlocked _IO_size_t -__fread_unlocked (buf, size, count, fp) - void *buf; - _IO_size_t size; - _IO_size_t count; - _IO_FILE *fp; +__fread_unlocked (void *buf, _IO_size_t size, _IO_size_t count, _IO_FILE *fp) { _IO_size_t bytes_requested = size * count; _IO_size_t bytes_read; diff --git a/libio/iofsetpos.c b/libio/iofsetpos.c index 21cc2f73e7..ca5104b8cd 100644 --- a/libio/iofsetpos.c +++ b/libio/iofsetpos.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993-2015 Free Software Foundation, Inc. +/* Copyright (C) 1993-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -39,9 +39,7 @@ #include <shlib-compat.h> int -_IO_new_fsetpos (fp, posp) - _IO_FILE *fp; - const _IO_fpos_t *posp; +_IO_new_fsetpos (_IO_FILE *fp, const _IO_fpos_t *posp) { int result; CHECK_FILE (fp, EOF); diff --git a/libio/iofsetpos64.c b/libio/iofsetpos64.c index 95ade6e701..adbac8ae39 100644 --- a/libio/iofsetpos64.c +++ b/libio/iofsetpos64.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993-2015 Free Software Foundation, Inc. +/* Copyright (C) 1993-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -31,9 +31,7 @@ #ifndef __OFF_T_MATCHES_OFF64_T int -_IO_new_fsetpos64 (fp, posp) - _IO_FILE *fp; - const _IO_fpos64_t *posp; +_IO_new_fsetpos64 (_IO_FILE *fp, const _IO_fpos64_t *posp) { int result; CHECK_FILE (fp, EOF); diff --git a/libio/ioftell.c b/libio/ioftell.c index 5b7fec6ae4..a05693b2f6 100644 --- a/libio/ioftell.c +++ b/libio/ioftell.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993-2015 Free Software Foundation, Inc. +/* Copyright (C) 1993-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -30,8 +30,7 @@ /* ANSI explicily requires setting errno to a positive value on failure. */ long int -_IO_ftell (fp) - _IO_FILE *fp; +_IO_ftell (_IO_FILE *fp) { _IO_off64_t pos; CHECK_FILE (fp, -1L); diff --git a/libio/iofwide.c b/libio/iofwide.c index 0c175d19d1..bc82e8b6c1 100644 --- a/libio/iofwide.c +++ b/libio/iofwide.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1999-2015 Free Software Foundation, Inc. +/* Copyright (C) 1999-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -85,9 +85,7 @@ const struct _IO_codecvt __libio_codecvt = the orientation first. */ #undef _IO_fwide int -_IO_fwide (fp, mode) - _IO_FILE *fp; - int mode; +_IO_fwide (_IO_FILE *fp, int mode) { /* Normalize the value. */ mode = mode < 0 ? -1 : (mode == 0 ? 0 : 1); diff --git a/libio/iofwrite.c b/libio/iofwrite.c index 891314693a..325ff430c4 100644 --- a/libio/iofwrite.c +++ b/libio/iofwrite.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993-2015 Free Software Foundation, Inc. +/* Copyright (C) 1993-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -27,11 +27,7 @@ #include "libioP.h" _IO_size_t -_IO_fwrite (buf, size, count, fp) - const void *buf; - _IO_size_t size; - _IO_size_t count; - _IO_FILE *fp; +_IO_fwrite (const void *buf, _IO_size_t size, _IO_size_t count, _IO_FILE *fp) { _IO_size_t request = size * count; _IO_size_t written = 0; diff --git a/libio/iofwrite_u.c b/libio/iofwrite_u.c index 09bf9f5db7..188321bb08 100644 --- a/libio/iofwrite_u.c +++ b/libio/iofwrite_u.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993-2015 Free Software Foundation, Inc. +/* Copyright (C) 1993-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -30,11 +30,8 @@ #undef fwrite_unlocked _IO_size_t -fwrite_unlocked (buf, size, count, fp) - const void *buf; - _IO_size_t size; - _IO_size_t count; - _IO_FILE *fp; +fwrite_unlocked (const void *buf, _IO_size_t size, _IO_size_t count, + _IO_FILE *fp) { _IO_size_t request = size * count; _IO_size_t written = 0; diff --git a/libio/iogetdelim.c b/libio/iogetdelim.c index ac93044bb5..50fda58e68 100644 --- a/libio/iogetdelim.c +++ b/libio/iogetdelim.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1994-2015 Free Software Foundation, Inc. +/* Copyright (C) 1994-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -37,11 +37,7 @@ null terminator), or -1 on error or EOF. */ _IO_ssize_t -_IO_getdelim (lineptr, n, delimiter, fp) - char **lineptr; - _IO_size_t *n; - int delimiter; - _IO_FILE *fp; +_IO_getdelim (char **lineptr, _IO_size_t *n, int delimiter, _IO_FILE *fp) { _IO_ssize_t result; _IO_ssize_t cur_len = 0; diff --git a/libio/iogetline.c b/libio/iogetline.c index 0d939aba1d..944bad8701 100644 --- a/libio/iogetline.c +++ b/libio/iogetline.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993-2015 Free Software Foundation, Inc. +/* Copyright (C) 1993-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -28,12 +28,8 @@ #include <string.h> _IO_size_t -_IO_getline (fp, buf, n, delim, extract_delim) - _IO_FILE *fp; - char *buf; - _IO_size_t n; - int delim; - int extract_delim; +_IO_getline (_IO_FILE *fp, char *buf, _IO_size_t n, int delim, + int extract_delim) { return _IO_getline_info (fp, buf, n, delim, extract_delim, (int *) 0); } @@ -48,13 +44,8 @@ libc_hidden_def (_IO_getline) If extract_delim > 0, insert delim in output. */ _IO_size_t -_IO_getline_info (fp, buf, n, delim, extract_delim, eof) - _IO_FILE *fp; - char *buf; - _IO_size_t n; - int delim; - int extract_delim; - int *eof; +_IO_getline_info (_IO_FILE *fp, char *buf, _IO_size_t n, int delim, + int extract_delim, int *eof) { char *ptr = buf; if (eof != NULL) diff --git a/libio/iogets.c b/libio/iogets.c index 9851e7744c..4e2c99f843 100644 --- a/libio/iogets.c +++ b/libio/iogets.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993-2015 Free Software Foundation, Inc. +/* Copyright (C) 1993-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -27,9 +27,8 @@ #include "libioP.h" #include <limits.h> -char* -_IO_gets (buf) - char *buf; +char * +_IO_gets (char *buf) { _IO_size_t count; int ch; diff --git a/libio/iogetwline.c b/libio/iogetwline.c index b668a77e38..b2e11bcec3 100644 --- a/libio/iogetwline.c +++ b/libio/iogetwline.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993-2015 Free Software Foundation, Inc. +/* Copyright (C) 1993-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -33,12 +33,8 @@ #endif _IO_size_t -_IO_getwline (fp, buf, n, delim, extract_delim) - _IO_FILE *fp; - wchar_t *buf; - _IO_size_t n; - wint_t delim; - int extract_delim; +_IO_getwline (_IO_FILE *fp, wchar_t *buf, _IO_size_t n, wint_t delim, + int extract_delim) { return _IO_getwline_info (fp, buf, n, delim, extract_delim, (wint_t *) 0); } @@ -52,13 +48,8 @@ _IO_getwline (fp, buf, n, delim, extract_delim) If extract_delim > 0, insert delim in output. */ _IO_size_t -_IO_getwline_info (fp, buf, n, delim, extract_delim, eof) - _IO_FILE *fp; - wchar_t *buf; - _IO_size_t n; - wint_t delim; - int extract_delim; - wint_t *eof; +_IO_getwline_info (_IO_FILE *fp, wchar_t *buf, _IO_size_t n, wint_t delim, + int extract_delim, wint_t *eof) { wchar_t *ptr = buf; if (eof != NULL) diff --git a/libio/iopadn.c b/libio/iopadn.c index 304ce0877c..0e509df09c 100644 --- a/libio/iopadn.c +++ b/libio/iopadn.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993-2015 Free Software Foundation, Inc. +/* Copyright (C) 1993-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -33,10 +33,7 @@ static char const zeroes[PADSIZE] = {'0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0'}; _IO_ssize_t -_IO_padn (fp, pad, count) - _IO_FILE *fp; - int pad; - _IO_ssize_t count; +_IO_padn (_IO_FILE *fp, int pad, _IO_ssize_t count) { char padbuf[PADSIZE]; const char *padptr; diff --git a/libio/iopopen.c b/libio/iopopen.c index 53da776d86..9ddde23494 100644 --- a/libio/iopopen.c +++ b/libio/iopopen.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993-2015 Free Software Foundation, Inc. +/* Copyright (C) 1993-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. Written by Per Bothner <bothner@cygnus.com>. @@ -106,10 +106,7 @@ unlock (void *not_used) #endif _IO_FILE * -_IO_new_proc_open (fp, command, mode) - _IO_FILE *fp; - const char *command; - const char *mode; +_IO_new_proc_open (_IO_FILE *fp, const char *command, const char *mode) { int read_or_write; int parent_end, child_end; @@ -272,9 +269,7 @@ _IO_new_proc_open (fp, command, mode) } _IO_FILE * -_IO_new_popen (command, mode) - const char *command; - const char *mode; +_IO_new_popen (const char *command, const char *mode) { struct locked_FILE { @@ -306,8 +301,7 @@ _IO_new_popen (command, mode) } int -_IO_new_proc_close (fp) - _IO_FILE *fp; +_IO_new_proc_close (_IO_FILE *fp) { /* This is not name-space clean. FIXME! */ int wstatus; diff --git a/libio/ioputs.c b/libio/ioputs.c index 39b4bb7218..bc10e3cef8 100644 --- a/libio/ioputs.c +++ b/libio/ioputs.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993-2015 Free Software Foundation, Inc. +/* Copyright (C) 1993-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -29,8 +29,7 @@ #include <limits.h> int -_IO_puts (str) - const char *str; +_IO_puts (const char *str) { int result = EOF; _IO_size_t len = strlen (str); diff --git a/libio/ioseekoff.c b/libio/ioseekoff.c index 11765cfb76..05d90bbeec 100644 --- a/libio/ioseekoff.c +++ b/libio/ioseekoff.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993-2015 Free Software Foundation, Inc. +/* Copyright (C) 1993-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -35,11 +35,7 @@ extern int errno; #endif _IO_off64_t -_IO_seekoff_unlocked (fp, offset, dir, mode) - _IO_FILE *fp; - _IO_off64_t offset; - int dir; - int mode; +_IO_seekoff_unlocked (_IO_FILE *fp, _IO_off64_t offset, int dir, int mode) { if (dir != _IO_seek_cur && dir != _IO_seek_set && dir != _IO_seek_end) { @@ -71,11 +67,7 @@ _IO_seekoff_unlocked (fp, offset, dir, mode) _IO_off64_t -_IO_seekoff (fp, offset, dir, mode) - _IO_FILE *fp; - _IO_off64_t offset; - int dir; - int mode; +_IO_seekoff (_IO_FILE *fp, _IO_off64_t offset, int dir, int mode) { _IO_off64_t retval; diff --git a/libio/ioseekpos.c b/libio/ioseekpos.c index a7652a1dde..2789b19645 100644 --- a/libio/ioseekpos.c +++ b/libio/ioseekpos.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993-2015 Free Software Foundation, Inc. +/* Copyright (C) 1993-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -27,10 +27,7 @@ #include <libioP.h> _IO_off64_t -_IO_seekpos_unlocked (fp, pos, mode) - _IO_FILE *fp; - _IO_off64_t pos; - int mode; +_IO_seekpos_unlocked (_IO_FILE *fp, _IO_off64_t pos, int mode) { /* If we have a backup buffer, get rid of it, since the __seekoff callback may not know to do the right thing about it. @@ -51,10 +48,7 @@ _IO_seekpos_unlocked (fp, pos, mode) _IO_off64_t -_IO_seekpos (fp, pos, mode) - _IO_FILE *fp; - _IO_off64_t pos; - int mode; +_IO_seekpos (_IO_FILE *fp, _IO_off64_t pos, int mode) { _IO_off64_t retval; diff --git a/libio/iosetbuffer.c b/libio/iosetbuffer.c index 0a41c10123..fcdb125047 100644 --- a/libio/iosetbuffer.c +++ b/libio/iosetbuffer.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993-2015 Free Software Foundation, Inc. +/* Copyright (C) 1993-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -27,10 +27,7 @@ #include "libioP.h" void -_IO_setbuffer (fp, buf, size) - _IO_FILE *fp; - char *buf; - _IO_size_t size; +_IO_setbuffer (_IO_FILE *fp, char *buf, _IO_size_t size) { CHECK_FILE (fp, ); _IO_acquire_lock (fp); diff --git a/libio/iosetvbuf.c b/libio/iosetvbuf.c index 71a64f8fae..75f937f343 100644 --- a/libio/iosetvbuf.c +++ b/libio/iosetvbuf.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993-2015 Free Software Foundation, Inc. +/* Copyright (C) 1993-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -31,11 +31,7 @@ #define _IONBF 2 /* No buffering. */ int -_IO_setvbuf (fp, buf, mode, size) - _IO_FILE *fp; - char *buf; - int mode; - _IO_size_t size; +_IO_setvbuf (_IO_FILE *fp, char *buf, int mode, _IO_size_t size) { int result; CHECK_FILE (fp, EOF); diff --git a/libio/ioungetc.c b/libio/ioungetc.c index 8553399131..093af744b4 100644 --- a/libio/ioungetc.c +++ b/libio/ioungetc.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993-2015 Free Software Foundation, Inc. +/* Copyright (C) 1993-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -27,9 +27,7 @@ #include "libioP.h" int -_IO_ungetc (c, fp) - int c; - _IO_FILE *fp; +_IO_ungetc (int c, _IO_FILE *fp) { int result; CHECK_FILE (fp, EOF); diff --git a/libio/ioungetwc.c b/libio/ioungetwc.c index afc5ce4197..7d50288a89 100644 --- a/libio/ioungetwc.c +++ b/libio/ioungetwc.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993-2015 Free Software Foundation, Inc. +/* Copyright (C) 1993-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -28,9 +28,7 @@ #include <wchar.h> wint_t -ungetwc (c, fp) - wint_t c; - _IO_FILE *fp; +ungetwc (wint_t c, _IO_FILE *fp) { wint_t result; CHECK_FILE (fp, WEOF); diff --git a/libio/iovdprintf.c b/libio/iovdprintf.c index 116912a1af..8ca55fccae 100644 --- a/libio/iovdprintf.c +++ b/libio/iovdprintf.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1995-2015 Free Software Foundation, Inc. +/* Copyright (C) 1995-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -28,10 +28,7 @@ #include <stdio_ext.h> int -_IO_vdprintf (d, format, arg) - int d; - const char *format; - _IO_va_list arg; +_IO_vdprintf (int d, const char *format, _IO_va_list arg) { struct _IO_FILE_plus tmpfil; struct _IO_wide_data wd; diff --git a/libio/iovsprintf.c b/libio/iovsprintf.c index b6cc6b3fa1..712d178c2a 100644 --- a/libio/iovsprintf.c +++ b/libio/iovsprintf.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993-2015 Free Software Foundation, Inc. +/* Copyright (C) 1993-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/libio/iovsscanf.c b/libio/iovsscanf.c index c4fbd1b610..18d9aaa5c0 100644 --- a/libio/iovsscanf.c +++ b/libio/iovsscanf.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993-2015 Free Software Foundation, Inc. +/* Copyright (C) 1993-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -28,10 +28,7 @@ #include "strfile.h" int -_IO_vsscanf (string, format, args) - const char *string; - const char *format; - _IO_va_list args; +_IO_vsscanf (const char *string, const char *format, _IO_va_list args) { int ret; _IO_strfile sf; diff --git a/libio/iovswscanf.c b/libio/iovswscanf.c index a228641a85..ff360696ca 100644 --- a/libio/iovswscanf.c +++ b/libio/iovswscanf.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993-2015 Free Software Foundation, Inc. +/* Copyright (C) 1993-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/libio/iowpadn.c b/libio/iowpadn.c index e65a6492a6..9881205436 100644 --- a/libio/iowpadn.c +++ b/libio/iowpadn.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993-2015 Free Software Foundation, Inc. +/* Copyright (C) 1993-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -39,10 +39,7 @@ static wchar_t const zeroes[PADSIZE] = }; _IO_ssize_t -_IO_wpadn (fp, pad, count) - _IO_FILE *fp; - wint_t pad; - _IO_ssize_t count; +_IO_wpadn (_IO_FILE *fp, wint_t pad, _IO_ssize_t count) { wchar_t padbuf[PADSIZE]; const wchar_t *padptr; diff --git a/libio/libc_fatal.c b/libio/libc_fatal.c index 096cd28500..bb0b5bb85e 100644 --- a/libio/libc_fatal.c +++ b/libio/libc_fatal.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993-2015 Free Software Foundation, Inc. +/* Copyright (C) 1993-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -19,8 +19,7 @@ /* Abort with an error message. */ void -__libc_fatal (message) - const char *message; +__libc_fatal (const char *message) { /* This function should write MESSAGE out in the most reliable way. It is called in situations like internal stdio lossage. */ diff --git a/libio/libio.h b/libio/libio.h index 9ff1fb002d..efd09f120b 100644 --- a/libio/libio.h +++ b/libio/libio.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2015 Free Software Foundation, Inc. +/* Copyright (C) 1991-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. Written by Per Bothner <bothner@cygnus.com>. @@ -145,11 +145,7 @@ struct _IO_jump_t; struct _IO_FILE; /* Handle lock. */ #ifdef _IO_MTSAFE_IO -# if defined __GLIBC__ && __GLIBC__ >= 2 -# include <bits/stdio-lock.h> -# else -/*# include <comthread.h>*/ -# endif +/* _IO_lock_t defined in internal headers during the glibc build. */ #else typedef void _IO_lock_t; #endif @@ -297,14 +293,13 @@ struct _IO_FILE_complete struct _IO_wide_data *_wide_data; struct _IO_FILE *_freeres_list; void *_freeres_buf; - size_t _freeres_size; # else void *__pad1; void *__pad2; void *__pad3; void *__pad4; - size_t __pad5; # endif + size_t __pad5; int _mode; /* Make sure we don't get into trouble again. */ char _unused2[15 * sizeof (int) - 4 * sizeof (void *) - sizeof (size_t)]; diff --git a/libio/libioP.h b/libio/libioP.h index 0f16e2dbd1..8706af2d90 100644 --- a/libio/libioP.h +++ b/libio/libioP.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1993-2015 Free Software Foundation, Inc. +/* Copyright (C) 1993-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -39,7 +39,7 @@ # define __set_errno(Val) errno = (Val) #endif #if defined __GLIBC__ && __GLIBC__ >= 2 -# include <bits/libc-lock.h> +# include <libc-lock.h> #else /*# include <comthread.h>*/ #endif @@ -760,46 +760,6 @@ extern _IO_off64_t _IO_seekpos_unlocked (_IO_FILE *, _IO_off64_t, int) # define munmap __munmap # define ftruncate __ftruncate # endif - -# define ROUND_TO_PAGE(_S) \ - (((_S) + EXEC_PAGESIZE - 1) & ~(EXEC_PAGESIZE - 1)) - -# define FREE_BUF(_B, _S) \ - munmap ((_B), ROUND_TO_PAGE (_S)) -# define ALLOC_BUF(_B, _S, _R) \ - do { \ - (_B) = (char *) mmap (0, ROUND_TO_PAGE (_S), \ - PROT_READ | PROT_WRITE, \ - MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); \ - if ((_B) == (char *) MAP_FAILED) \ - return (_R); \ - } while (0) -# define ALLOC_WBUF(_B, _S, _R) \ - do { \ - (_B) = (wchar_t *) mmap (0, ROUND_TO_PAGE (_S), \ - PROT_READ | PROT_WRITE, \ - MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); \ - if ((_B) == (wchar_t *) MAP_FAILED) \ - return (_R); \ - } while (0) - -#else /* _G_HAVE_MMAP */ - -# define FREE_BUF(_B, _S) \ - free(_B) -# define ALLOC_BUF(_B, _S, _R) \ - do { \ - (_B) = (char*)malloc(_S); \ - if ((_B) == NULL) \ - return (_R); \ - } while (0) -# define ALLOC_WBUF(_B, _S, _R) \ - do { \ - (_B) = (wchar_t *)malloc(_S); \ - if ((_B) == NULL) \ - return (_R); \ - } while (0) - #endif /* _G_HAVE_MMAP */ #ifndef OS_FSTAT diff --git a/libio/memstream.c b/libio/memstream.c index 84742d1236..7fa5245e72 100644 --- a/libio/memstream.c +++ b/libio/memstream.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1995-2015 Free Software Foundation, Inc. +/* Copyright (C) 1995-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -61,9 +61,7 @@ static const struct _IO_jump_t _IO_mem_jumps = necessary. *BUFLOC and *SIZELOC are updated with the buffer's location and the number of characters written on fflush or fclose. */ _IO_FILE * -__open_memstream (bufloc, sizeloc) - char **bufloc; - _IO_size_t *sizeloc; +__open_memstream (char **bufloc, _IO_size_t *sizeloc) { struct locked_FILE { @@ -105,8 +103,7 @@ weak_alias (__open_memstream, open_memstream) static int -_IO_mem_sync (fp) - _IO_FILE* fp; +_IO_mem_sync (_IO_FILE *fp) { struct _IO_FILE_memstream *mp = (struct _IO_FILE_memstream *) fp; @@ -126,9 +123,7 @@ _IO_mem_sync (fp) static void -_IO_mem_finish (fp, dummy) - _IO_FILE* fp; - int dummy; +_IO_mem_finish (_IO_FILE *fp, int dummy) { struct _IO_FILE_memstream *mp = (struct _IO_FILE_memstream *) fp; diff --git a/libio/obprintf.c b/libio/obprintf.c index d61de6af10..aa17b46da8 100644 --- a/libio/obprintf.c +++ b/libio/obprintf.c @@ -1,5 +1,5 @@ /* Print output of stream to given obstack. - Copyright (C) 1996-2015 Free Software Foundation, Inc. + Copyright (C) 1996-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. diff --git a/libio/oldfileops.c b/libio/oldfileops.c index 54789b2349..4f3bdfe489 100644 --- a/libio/oldfileops.c +++ b/libio/oldfileops.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993-2015 Free Software Foundation, Inc. +/* Copyright (C) 1993-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. Written by Per Bothner <bothner@cygnus.com>. @@ -41,6 +41,7 @@ #include <string.h> #include <errno.h> #include <stdlib.h> +#include <unistd.h> #ifndef errno extern int errno; #endif @@ -113,8 +114,7 @@ extern int errno; void attribute_compat_text_section -_IO_old_file_init (fp) - struct _IO_FILE_plus *fp; +_IO_old_file_init (struct _IO_FILE_plus *fp) { /* POSIX.1 allows another file handle to be used to change the position of our file descriptor. Hence we actually don't know the actual @@ -140,8 +140,7 @@ _IO_old_file_init (fp) int attribute_compat_text_section -_IO_old_file_close_it (fp) - _IO_FILE *fp; +_IO_old_file_close_it (_IO_FILE *fp) { int write_status, close_status; if (!_IO_file_is_open (fp)) @@ -169,9 +168,7 @@ _IO_old_file_close_it (fp) void attribute_compat_text_section -_IO_old_file_finish (fp, dummy) - _IO_FILE *fp; - int dummy; +_IO_old_file_finish (_IO_FILE *fp, int dummy) { if (_IO_file_is_open (fp)) { @@ -184,10 +181,7 @@ _IO_old_file_finish (fp, dummy) _IO_FILE * attribute_compat_text_section -_IO_old_file_fopen (fp, filename, mode) - _IO_FILE *fp; - const char *filename; - const char *mode; +_IO_old_file_fopen (_IO_FILE *fp, const char *filename, const char *mode) { int oflags = 0, omode; int read_write, fdesc; @@ -234,9 +228,7 @@ _IO_old_file_fopen (fp, filename, mode) _IO_FILE * attribute_compat_text_section -_IO_old_file_attach (fp, fd) - _IO_FILE *fp; - int fd; +_IO_old_file_attach (_IO_FILE *fp, int fd) { if (_IO_file_is_open (fp)) return NULL; @@ -254,10 +246,7 @@ _IO_old_file_attach (fp, fd) _IO_FILE * attribute_compat_text_section -_IO_old_file_setbuf (fp, p, len) - _IO_FILE *fp; - char *p; - _IO_ssize_t len; +_IO_old_file_setbuf (_IO_FILE *fp, char *p, _IO_ssize_t len) { if (_IO_default_setbuf (fp, p, len) == NULL) return NULL; @@ -276,10 +265,7 @@ static int old_do_write (_IO_FILE *, const char *, _IO_size_t); int attribute_compat_text_section -_IO_old_do_write (fp, data, to_do) - _IO_FILE *fp; - const char *data; - _IO_size_t to_do; +_IO_old_do_write (_IO_FILE *fp, const char *data, _IO_size_t to_do) { return (to_do == 0 || (_IO_size_t) old_do_write (fp, data, to_do) == to_do) ? 0 : EOF; @@ -287,10 +273,7 @@ _IO_old_do_write (fp, data, to_do) static int attribute_compat_text_section -old_do_write (fp, data, to_do) - _IO_FILE *fp; - const char *data; - _IO_size_t to_do; +old_do_write (_IO_FILE *fp, const char *data, _IO_size_t to_do) { _IO_size_t count; if (fp->_flags & _IO_IS_APPENDING) @@ -320,8 +303,7 @@ old_do_write (fp, data, to_do) int attribute_compat_text_section -_IO_old_file_underflow (fp) - _IO_FILE *fp; +_IO_old_file_underflow (_IO_FILE *fp) { _IO_ssize_t count; #if 0 @@ -385,9 +367,7 @@ _IO_old_file_underflow (fp) int attribute_compat_text_section -_IO_old_file_overflow (f, ch) - _IO_FILE *f; - int ch; +_IO_old_file_overflow (_IO_FILE *f, int ch) { if (f->_flags & _IO_NO_WRITES) /* SET ERROR */ { @@ -437,8 +417,7 @@ _IO_old_file_overflow (f, ch) int attribute_compat_text_section -_IO_old_file_sync (fp) - _IO_FILE *fp; +_IO_old_file_sync (_IO_FILE *fp) { _IO_ssize_t delta; int retval = 0; @@ -472,11 +451,7 @@ _IO_old_file_sync (fp) _IO_off64_t attribute_compat_text_section -_IO_old_file_seekoff (fp, offset, dir, mode) - _IO_FILE *fp; - _IO_off64_t offset; - int dir; - int mode; +_IO_old_file_seekoff (_IO_FILE *fp, _IO_off64_t offset, int dir, int mode) { _IO_off_t result; _IO_off64_t delta, new_offset; @@ -659,10 +634,7 @@ resync: _IO_ssize_t attribute_compat_text_section -_IO_old_file_write (f, data, n) - _IO_FILE *f; - const void *data; - _IO_ssize_t n; +_IO_old_file_write (_IO_FILE *f, const void *data, _IO_ssize_t n) { _IO_ssize_t to_do = n; while (to_do > 0) @@ -684,10 +656,7 @@ _IO_old_file_write (f, data, n) _IO_size_t attribute_compat_text_section -_IO_old_file_xsputn (f, data, n) - _IO_FILE *f; - const void *data; - _IO_size_t n; +_IO_old_file_xsputn (_IO_FILE *f, const void *data, _IO_size_t n) { const char *s = (char *) data; _IO_size_t to_do = n; diff --git a/libio/oldfmemopen.c b/libio/oldfmemopen.c index 8e35672327..2678a5d6be 100644 --- a/libio/oldfmemopen.c +++ b/libio/oldfmemopen.c @@ -1,5 +1,5 @@ /* Fmemopen implementation. - Copyright (C) 2000-2015 Free Software Foundation, Inc. + Copyright (C) 2000-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Hanno Mueller, kontakt@hanno.de, 2000. @@ -204,6 +204,7 @@ __old_fmemopen (void *buf, size_t len, const char *mode) { cookie_io_functions_t iof; fmemopen_cookie_t *c; + FILE *result; if (__glibc_unlikely (len == 0)) { @@ -259,7 +260,16 @@ __old_fmemopen (void *buf, size_t len, const char *mode) iof.seek = fmemopen_seek; iof.close = fmemopen_close; - return _IO_fopencookie (c, mode, iof); + result = _IO_fopencookie (c, mode, iof); + if (__glibc_unlikely (result == NULL)) + { + if (c->mybuffer) + free (c->buffer); + + free (c); + } + + return result; } compat_symbol (libc, __old_fmemopen, fmemopen, GLIBC_2_2); #endif diff --git a/libio/oldiofclose.c b/libio/oldiofclose.c index a967c2d204..0c96cb4f6f 100644 --- a/libio/oldiofclose.c +++ b/libio/oldiofclose.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993-2015 Free Software Foundation, Inc. +/* Copyright (C) 1993-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -33,8 +33,7 @@ int attribute_compat_text_section -_IO_old_fclose (fp) - _IO_FILE *fp; +_IO_old_fclose (_IO_FILE *fp) { int status; diff --git a/libio/oldiofdopen.c b/libio/oldiofdopen.c index e068ec70fc..33406ff240 100644 --- a/libio/oldiofdopen.c +++ b/libio/oldiofdopen.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993-2015 Free Software Foundation, Inc. +/* Copyright (C) 1993-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -38,9 +38,7 @@ _IO_FILE * attribute_compat_text_section -_IO_old_fdopen (fd, mode) - int fd; - const char *mode; +_IO_old_fdopen (int fd, const char *mode) { int read_write; int posix_mode = 0; diff --git a/libio/oldiofgetpos.c b/libio/oldiofgetpos.c index e76a5a158f..eab8c5f9b3 100644 --- a/libio/oldiofgetpos.c +++ b/libio/oldiofgetpos.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993-2015 Free Software Foundation, Inc. +/* Copyright (C) 1993-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -32,9 +32,7 @@ int attribute_compat_text_section -_IO_old_fgetpos (fp, posp) - _IO_FILE *fp; - _IO_fpos_t *posp; +_IO_old_fgetpos (_IO_FILE *fp, _IO_fpos_t *posp) { _IO_off_t pos; CHECK_FILE (fp, EOF); diff --git a/libio/oldiofgetpos64.c b/libio/oldiofgetpos64.c index db27f88b70..d4e4861056 100644 --- a/libio/oldiofgetpos64.c +++ b/libio/oldiofgetpos64.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993-2015 Free Software Foundation, Inc. +/* Copyright (C) 1993-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -32,9 +32,7 @@ int attribute_compat_text_section -_IO_old_fgetpos64 (fp, posp) - _IO_FILE *fp; - _IO_fpos64_t *posp; +_IO_old_fgetpos64 (_IO_FILE *fp, _IO_fpos64_t *posp) { _IO_off64_t pos; CHECK_FILE (fp, EOF); diff --git a/libio/oldiofopen.c b/libio/oldiofopen.c index a90a60168b..cc7c34282c 100644 --- a/libio/oldiofopen.c +++ b/libio/oldiofopen.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993-2015 Free Software Foundation, Inc. +/* Copyright (C) 1993-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -34,9 +34,7 @@ _IO_FILE * attribute_compat_text_section -_IO_old_fopen (filename, mode) - const char *filename; - const char *mode; +_IO_old_fopen (const char *filename, const char *mode) { struct locked_FILE { diff --git a/libio/oldiofsetpos.c b/libio/oldiofsetpos.c index 24571b4719..e931572717 100644 --- a/libio/oldiofsetpos.c +++ b/libio/oldiofsetpos.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993-2015 Free Software Foundation, Inc. +/* Copyright (C) 1993-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -31,9 +31,7 @@ #if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_2) int attribute_compat_text_section -_IO_old_fsetpos (fp, posp) - _IO_FILE *fp; - const _IO_fpos_t *posp; +_IO_old_fsetpos (_IO_FILE *fp, const _IO_fpos_t *posp) { int result; CHECK_FILE (fp, EOF); diff --git a/libio/oldiofsetpos64.c b/libio/oldiofsetpos64.c index 3b8eba1a54..f1514c5792 100644 --- a/libio/oldiofsetpos64.c +++ b/libio/oldiofsetpos64.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993-2015 Free Software Foundation, Inc. +/* Copyright (C) 1993-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -32,9 +32,7 @@ int attribute_compat_text_section -_IO_old_fsetpos64 (fp, posp) - _IO_FILE *fp; - const _IO_fpos64_t *posp; +_IO_old_fsetpos64 (_IO_FILE *fp, const _IO_fpos64_t *posp) { int result; CHECK_FILE (fp, EOF); diff --git a/libio/oldiopopen.c b/libio/oldiopopen.c index fb4c7b8597..ea75b4fb90 100644 --- a/libio/oldiopopen.c +++ b/libio/oldiopopen.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1998-2015 Free Software Foundation, Inc. +/* Copyright (C) 1998-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. Written by Per Bothner <bothner@cygnus.com>. @@ -115,10 +115,7 @@ unlock (void *not_used) _IO_FILE * attribute_compat_text_section -_IO_old_proc_open (fp, command, mode) - _IO_FILE *fp; - const char *command; - const char *mode; +_IO_old_proc_open (_IO_FILE *fp, const char *command, const char *mode) { volatile int read_or_write; volatile int parent_end, child_end; @@ -194,9 +191,7 @@ _IO_old_proc_open (fp, command, mode) _IO_FILE * attribute_compat_text_section -_IO_old_popen (command, mode) - const char *command; - const char *mode; +_IO_old_popen (const char *command, const char *mode) { struct locked_FILE { @@ -229,8 +224,7 @@ _IO_old_popen (command, mode) int attribute_compat_text_section -_IO_old_proc_close (fp) - _IO_FILE *fp; +_IO_old_proc_close (_IO_FILE *fp) { /* This is not name-space clean. FIXME! */ int wstatus; diff --git a/libio/oldpclose.c b/libio/oldpclose.c index cafa405110..13ee2558e7 100644 --- a/libio/oldpclose.c +++ b/libio/oldpclose.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1998-2015 Free Software Foundation, Inc. +/* Copyright (C) 1998-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -34,8 +34,7 @@ int attribute_compat_text_section -__old_pclose (fp) - FILE *fp; +__old_pclose (FILE *fp) { #if 0 /* Does not actually test that stream was created by popen(). Instead, diff --git a/libio/oldstdfiles.c b/libio/oldstdfiles.c index f3bb19e250..609b7d9ef2 100644 --- a/libio/oldstdfiles.c +++ b/libio/oldstdfiles.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993-2015 Free Software Foundation, Inc. +/* Copyright (C) 1993-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/libio/oldtmpfile.c b/libio/oldtmpfile.c index 53f808d9c8..00f14f7a8b 100644 --- a/libio/oldtmpfile.c +++ b/libio/oldtmpfile.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2015 Free Software Foundation, Inc. +/* Copyright (C) 1991-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/libio/pclose.c b/libio/pclose.c index 019b74d9d1..219be57dbd 100644 --- a/libio/pclose.c +++ b/libio/pclose.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993-2015 Free Software Foundation, Inc. +/* Copyright (C) 1993-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -30,8 +30,7 @@ #include <shlib-compat.h> int -__new_pclose (fp) - FILE *fp; +__new_pclose (FILE *fp) { #if 0 /* Does not actually test that stream was created by popen(). Instead, diff --git a/libio/peekc.c b/libio/peekc.c index c7b443bb1f..8f33fdeec3 100644 --- a/libio/peekc.c +++ b/libio/peekc.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993-2015 Free Software Foundation, Inc. +/* Copyright (C) 1993-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -30,8 +30,7 @@ #undef _IO_peekc int -_IO_peekc_locked (fp) - _IO_FILE *fp; +_IO_peekc_locked (_IO_FILE *fp) { int result; CHECK_FILE (fp, EOF); diff --git a/libio/putc.c b/libio/putc.c index 46140de1e6..fd233917b3 100644 --- a/libio/putc.c +++ b/libio/putc.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2015 Free Software Foundation, Inc. +/* Copyright (C) 1991-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -21,9 +21,7 @@ #undef _IO_putc int -_IO_putc (c, fp) - int c; - _IO_FILE *fp; +_IO_putc (int c, _IO_FILE *fp) { int result; CHECK_FILE (fp, EOF); diff --git a/libio/putc_u.c b/libio/putc_u.c index e97a78e40c..540a6c4cdc 100644 --- a/libio/putc_u.c +++ b/libio/putc_u.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2015 Free Software Foundation, Inc. +/* Copyright (C) 1991-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -21,9 +21,7 @@ #undef putc_unlocked int -putc_unlocked (c, fp) - int c; - _IO_FILE *fp; +putc_unlocked (int c, _IO_FILE *fp) { CHECK_FILE (fp, EOF); return _IO_putc_unlocked (c, fp); diff --git a/libio/putchar.c b/libio/putchar.c index d401d2b6c9..5df3decf57 100644 --- a/libio/putchar.c +++ b/libio/putchar.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2015 Free Software Foundation, Inc. +/* Copyright (C) 1991-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -21,8 +21,7 @@ #undef putchar int -putchar (c) - int c; +putchar (int c) { int result; _IO_acquire_lock (_IO_stdout); diff --git a/libio/putchar_u.c b/libio/putchar_u.c index 2fd767b717..8c41ca3218 100644 --- a/libio/putchar_u.c +++ b/libio/putchar_u.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2015 Free Software Foundation, Inc. +/* Copyright (C) 1991-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -21,8 +21,7 @@ #undef putchar_unlocked int -putchar_unlocked (c) - int c; +putchar_unlocked (int c) { CHECK_FILE (_IO_stdout, EOF); return _IO_putc_unlocked (c, _IO_stdout); diff --git a/libio/putwc.c b/libio/putwc.c index b441f24699..a5261ea8c4 100644 --- a/libio/putwc.c +++ b/libio/putwc.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2015 Free Software Foundation, Inc. +/* Copyright (C) 1991-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -19,9 +19,7 @@ #include <wchar.h> wint_t -putwc (wc, fp) - wchar_t wc; - _IO_FILE *fp; +putwc (wchar_t wc, _IO_FILE *fp) { wint_t result; CHECK_FILE (fp, WEOF); diff --git a/libio/putwc_u.c b/libio/putwc_u.c index e2f59ec2b5..31bc5f56aa 100644 --- a/libio/putwc_u.c +++ b/libio/putwc_u.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2015 Free Software Foundation, Inc. +/* Copyright (C) 1991-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -19,9 +19,7 @@ #include <wchar.h> wint_t -putwc_unlocked (wc, fp) - wchar_t wc; - _IO_FILE *fp; +putwc_unlocked (wchar_t wc, _IO_FILE *fp) { CHECK_FILE (fp, WEOF); return _IO_putwc_unlocked (wc, fp); diff --git a/libio/putwchar.c b/libio/putwchar.c index 41d834b144..2534954b4f 100644 --- a/libio/putwchar.c +++ b/libio/putwchar.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2015 Free Software Foundation, Inc. +/* Copyright (C) 1991-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -19,8 +19,7 @@ #include <wchar.h> wint_t -putwchar (wc) - wchar_t wc; +putwchar (wchar_t wc) { wint_t result; _IO_acquire_lock (_IO_stdout); diff --git a/libio/putwchar_u.c b/libio/putwchar_u.c index dec9e38c7d..f3c9ef45be 100644 --- a/libio/putwchar_u.c +++ b/libio/putwchar_u.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2015 Free Software Foundation, Inc. +/* Copyright (C) 1991-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -19,8 +19,7 @@ #include <wchar.h> wint_t -putwchar_unlocked (wc) - wchar_t wc; +putwchar_unlocked (wchar_t wc) { CHECK_FILE (_IO_stdout, WEOF); return _IO_putwc_unlocked (wc, _IO_stdout); diff --git a/libio/rewind.c b/libio/rewind.c index baa804a05e..c93c2e7993 100644 --- a/libio/rewind.c +++ b/libio/rewind.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993-2015 Free Software Foundation, Inc. +/* Copyright (C) 1993-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -28,8 +28,7 @@ #include <stdio.h> void -rewind (fp) - _IO_FILE *fp; +rewind (_IO_FILE *fp) { CHECK_FILE (fp, ); _IO_acquire_lock (fp); diff --git a/libio/setbuf.c b/libio/setbuf.c index a418bc1f32..ae8ca8aaec 100644 --- a/libio/setbuf.c +++ b/libio/setbuf.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993-2015 Free Software Foundation, Inc. +/* Copyright (C) 1993-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -28,9 +28,7 @@ #include "stdio.h" void -setbuf (fp, buf) - _IO_FILE *fp; - char *buf; +setbuf (_IO_FILE *fp, char *buf) { _IO_setbuffer (fp, buf, _IO_BUFSIZ); } diff --git a/libio/setlinebuf.c b/libio/setlinebuf.c index 482f0af935..1e1bc7d975 100644 --- a/libio/setlinebuf.c +++ b/libio/setlinebuf.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993-2015 Free Software Foundation, Inc. +/* Copyright (C) 1993-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -30,8 +30,7 @@ #undef setlinebuf void -setlinebuf (stream) - _IO_FILE *stream; +setlinebuf (_IO_FILE *stream) { _IO_setvbuf (stream, NULL, 1, 0); } diff --git a/libio/stdfiles.c b/libio/stdfiles.c index d52a1c58bb..1f583ed97d 100644 --- a/libio/stdfiles.c +++ b/libio/stdfiles.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993-2015 Free Software Foundation, Inc. +/* Copyright (C) 1993-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/libio/stdio.c b/libio/stdio.c index 0a44f8593f..6de85e88fb 100644 --- a/libio/stdio.c +++ b/libio/stdio.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993-2015 Free Software Foundation, Inc. +/* Copyright (C) 1993-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/libio/stdio.h b/libio/stdio.h index 19ab0ae0b9..d8d7fa0611 100644 --- a/libio/stdio.h +++ b/libio/stdio.h @@ -1,5 +1,5 @@ /* Define ISO C stdio on top of C++ iostreams. - Copyright (C) 1991-2015 Free Software Foundation, Inc. + Copyright (C) 1991-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/libio/strfile.h b/libio/strfile.h index 168eac7ed0..f7ada8eb22 100644 --- a/libio/strfile.h +++ b/libio/strfile.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1993-2015 Free Software Foundation, Inc. +/* Copyright (C) 1993-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/libio/strops.c b/libio/strops.c index 730dfc4ae1..0932d4c1b1 100644 --- a/libio/strops.c +++ b/libio/strops.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993-2015 Free Software Foundation, Inc. +/* Copyright (C) 1993-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -31,11 +31,8 @@ #include <stdio_ext.h> void -_IO_str_init_static_internal (sf, ptr, size, pstart) - _IO_strfile *sf; - char *ptr; - _IO_size_t size; - char *pstart; +_IO_str_init_static_internal (_IO_strfile *sf, char *ptr, _IO_size_t size, + char *pstart) { _IO_FILE *fp = &sf->_sbf._f; char *end; @@ -68,29 +65,20 @@ _IO_str_init_static_internal (sf, ptr, size, pstart) } void -_IO_str_init_static (sf, ptr, size, pstart) - _IO_strfile *sf; - char *ptr; - int size; - char *pstart; +_IO_str_init_static (_IO_strfile *sf, char *ptr, int size, char *pstart) { return _IO_str_init_static_internal (sf, ptr, size < 0 ? -1 : size, pstart); } void -_IO_str_init_readonly (sf, ptr, size) - _IO_strfile *sf; - const char *ptr; - int size; +_IO_str_init_readonly (_IO_strfile *sf, const char *ptr, int size) { _IO_str_init_static_internal (sf, (char *) ptr, size < 0 ? -1 : size, NULL); sf->_sbf._f._IO_file_flags |= _IO_NO_WRITES; } int -_IO_str_overflow (fp, c) - _IO_FILE *fp; - int c; +_IO_str_overflow (_IO_FILE *fp, int c) { int flush_only = c == EOF; _IO_size_t pos; @@ -151,8 +139,7 @@ _IO_str_overflow (fp, c) libc_hidden_def (_IO_str_overflow) int -_IO_str_underflow (fp) - _IO_FILE *fp; +_IO_str_underflow (_IO_FILE *fp) { if (fp->_IO_write_ptr > fp->_IO_read_end) fp->_IO_read_end = fp->_IO_write_ptr; @@ -172,8 +159,7 @@ libc_hidden_def (_IO_str_underflow) /* The size of the valid part of the buffer. */ _IO_ssize_t -_IO_str_count (fp) - _IO_FILE *fp; +_IO_str_count (_IO_FILE *fp) { return ((fp->_IO_write_ptr > fp->_IO_read_end ? fp->_IO_write_ptr : fp->_IO_read_end) @@ -246,11 +232,7 @@ enlarge_userbuf (_IO_FILE *fp, _IO_off64_t offset, int reading) _IO_off64_t -_IO_str_seekoff (fp, offset, dir, mode) - _IO_FILE *fp; - _IO_off64_t offset; - int dir; - int mode; +_IO_str_seekoff (_IO_FILE *fp, _IO_off64_t offset, int dir, int mode) { _IO_off64_t new_pos; @@ -323,9 +305,7 @@ _IO_str_seekoff (fp, offset, dir, mode) libc_hidden_def (_IO_str_seekoff) int -_IO_str_pbackfail (fp, c) - _IO_FILE *fp; - int c; +_IO_str_pbackfail (_IO_FILE *fp, int c) { if ((fp->_flags & _IO_NO_WRITES) && c != EOF) return EOF; @@ -334,9 +314,7 @@ _IO_str_pbackfail (fp, c) libc_hidden_def (_IO_str_pbackfail) void -_IO_str_finish (fp, dummy) - _IO_FILE *fp; - int dummy; +_IO_str_finish (_IO_FILE *fp, int dummy) { if (fp->_IO_buf_base && !(fp->_flags & _IO_USER_BUF)) (((_IO_strfile *) fp)->_s._free_buffer) (fp->_IO_buf_base); diff --git a/libio/swprintf.c b/libio/swprintf.c index 680968bf63..398d7f201f 100644 --- a/libio/swprintf.c +++ b/libio/swprintf.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2015 Free Software Foundation, Inc. +/* Copyright (C) 1991-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/libio/swscanf.c b/libio/swscanf.c index 397dbc554c..8d71c5834e 100644 --- a/libio/swscanf.c +++ b/libio/swscanf.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2015 Free Software Foundation, Inc. +/* Copyright (C) 1991-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/libio/test-fmemopen.c b/libio/test-fmemopen.c index 63ca89f300..1e52e86ce5 100644 --- a/libio/test-fmemopen.c +++ b/libio/test-fmemopen.c @@ -1,5 +1,5 @@ /* Test for fmemopen implementation. - Copyright (C) 2000-2015 Free Software Foundation, Inc. + Copyright (C) 2000-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Hanno Mueller, kontakt@hanno.de, 2000. @@ -19,9 +19,56 @@ static char buffer[] = "foobar"; +#include <errno.h> #include <stdio.h> #include <string.h> #include <errno.h> +#include <mcheck.h> + +static int +do_bz18820 (void) +{ + char ch; + FILE *stream; + + errno = 0; + stream = fmemopen (&ch, 1, "?"); + if (stream) + { + printf ("fmemopen: expected NULL, got %p\n", stream); + fclose (stream); + return 1; + } + if (errno != EINVAL) + { + printf ("fmemopen: got %i, expected EINVAL (%i)\n", errno, EINVAL); + return 10; + } + + stream = fmemopen (NULL, 42, "?"); + if (stream) + { + printf ("fmemopen: expected NULL, got %p\n", stream); + fclose (stream); + return 2; + } + + errno = 0; + stream = fmemopen (NULL, ~0, "w"); + if (stream) + { + printf ("fmemopen: expected NULL, got %p\n", stream); + fclose (stream); + return 3; + } + if (errno != ENOMEM) + { + printf ("fmemopen: got %i, expected ENOMEM (%i)\n", errno, ENOMEM); + return 20; + } + + return 0; +} static int do_test (void) @@ -30,6 +77,8 @@ do_test (void) FILE *stream; int ret = 0; + mtrace (); + stream = fmemopen (buffer, strlen (buffer), "r+"); while ((ch = fgetc (stream)) != EOF) @@ -44,7 +93,7 @@ do_test (void) fclose (stream); - return ret; + return ret + do_bz18820 (); } #define TEST_FUNCTION do_test () diff --git a/libio/test-freopen.c b/libio/test-freopen.c index f4df755851..9d36326d2b 100644 --- a/libio/test-freopen.c +++ b/libio/test-freopen.c @@ -1,5 +1,5 @@ /* Test for freopen implementation. - Copyright (C) 2000-2015 Free Software Foundation, Inc. + Copyright (C) 2000-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/libio/test-freopen.sh b/libio/test-freopen.sh index 82656459ce..5db163fb4b 100755 --- a/libio/test-freopen.sh +++ b/libio/test-freopen.sh @@ -1,6 +1,6 @@ -#! /bin/sh +#!/bin/sh # Test of freopen. -# Copyright (C) 2000-2015 Free Software Foundation, Inc. +# Copyright (C) 2000-2016 Free Software Foundation, Inc. # This file is part of the GNU C Library. # The GNU C Library is free software; you can redistribute it and/or diff --git a/libio/tst-fopenloc.c b/libio/tst-fopenloc.c index f7f5f37638..0f7edb64e9 100644 --- a/libio/tst-fopenloc.c +++ b/libio/tst-fopenloc.c @@ -1,5 +1,5 @@ /* Test for ,ccs= handling in fopen. - Copyright (C) 2001-2015 Free Software Foundation, Inc. + Copyright (C) 2001-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 2001. diff --git a/libio/tst-fputws.c b/libio/tst-fputws.c index 9d2ad46db9..dc4e870576 100644 --- a/libio/tst-fputws.c +++ b/libio/tst-fputws.c @@ -1,5 +1,5 @@ /* Test that we can write a multibyte character to an unbuffered stream. - Copyright (C) 2014-2015 Free Software Foundation, Inc. + Copyright (C) 2014-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/libio/tst-freopen.c b/libio/tst-freopen.c index d2ad96bdf7..a1579bbd57 100644 --- a/libio/tst-freopen.c +++ b/libio/tst-freopen.c @@ -1,5 +1,5 @@ /* Test freopen with mmap stdio. - Copyright (C) 2002-2015 Free Software Foundation, Inc. + Copyright (C) 2002-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Jakub Jelinek <jakub@redhat.com>, 2002. diff --git a/libio/tst-fseek.c b/libio/tst-fseek.c index 5d4b9089fe..9bb0d7f707 100644 --- a/libio/tst-fseek.c +++ b/libio/tst-fseek.c @@ -1,5 +1,5 @@ /* Verify that fseek/ftell combination works for wide chars. - Copyright (C) 2012-2015 Free Software Foundation, Inc. + Copyright (C) 2012-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/libio/tst-ftell-active-handler.c b/libio/tst-ftell-active-handler.c index 22cee86721..0620895260 100644 --- a/libio/tst-ftell-active-handler.c +++ b/libio/tst-ftell-active-handler.c @@ -1,6 +1,6 @@ /* Verify that ftell returns the correct value at various points before and after the handler on which it is called becomes active. - Copyright (C) 2014-2015 Free Software Foundation, Inc. + Copyright (C) 2014-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/libio/tst-ftell-append.c b/libio/tst-ftell-append.c index dcd0de2b80..1fd949e60a 100644 --- a/libio/tst-ftell-append.c +++ b/libio/tst-ftell-append.c @@ -1,6 +1,6 @@ /* Verify that ftell returns the correct value after a read and a write on a file opened in a+ mode. - Copyright (C) 2014-2015 Free Software Foundation, Inc. + Copyright (C) 2014-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/libio/tst-ftell-partial-wide.c b/libio/tst-ftell-partial-wide.c index 1129f1bbfc..f694f1f1b7 100644 --- a/libio/tst-ftell-partial-wide.c +++ b/libio/tst-ftell-partial-wide.c @@ -1,6 +1,6 @@ /* Verify that ftell does not go into an infinite loop when a conversion fails due to insufficient space in the buffer. - Copyright (C) 2014-2015 Free Software Foundation, Inc. + Copyright (C) 2014-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/libio/tst-fwrite-error.c b/libio/tst-fwrite-error.c index 31d13f5096..9bc740eed3 100644 --- a/libio/tst-fwrite-error.c +++ b/libio/tst-fwrite-error.c @@ -1,5 +1,5 @@ /* Test of fwrite() function, adapted from gnulib-tests in grep. - Copyright (C) 2011-2015 Free Software Foundation, Inc. + Copyright (C) 2011-2016 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/libio/tst-mmap-setvbuf.c b/libio/tst-mmap-setvbuf.c index 137a10e598..33d60b7bd4 100644 --- a/libio/tst-mmap-setvbuf.c +++ b/libio/tst-mmap-setvbuf.c @@ -1,5 +1,5 @@ /* Test setvbuf on readonly fopen (using mmap stdio). - Copyright (C) 2002-2015 Free Software Foundation, Inc. + Copyright (C) 2002-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Jakub Jelinek <jakub@redhat.com>, 2002. diff --git a/libio/tst-widetext.c b/libio/tst-widetext.c index ca80407d7d..0f934370f8 100644 --- a/libio/tst-widetext.c +++ b/libio/tst-widetext.c @@ -1,6 +1,6 @@ /* Test program for the wide character stream functions handling larger amounts of text. - Copyright (C) 2000-2015 Free Software Foundation, Inc. + Copyright (C) 2000-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>. diff --git a/libio/tst_getwc.c b/libio/tst_getwc.c index 2b8cb648d6..b36b07f6ff 100644 --- a/libio/tst_getwc.c +++ b/libio/tst_getwc.c @@ -1,5 +1,5 @@ /* Simple test of getwc in the C locale. - Copyright (C) 2000-2015 Free Software Foundation, Inc. + Copyright (C) 2000-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 2000. diff --git a/libio/tst_putwc.c b/libio/tst_putwc.c index 8c2a7dd198..d4ac2cf330 100644 --- a/libio/tst_putwc.c +++ b/libio/tst_putwc.c @@ -1,5 +1,5 @@ /* Simple test of putwc in the C locale. - Copyright (C) 2000-2015 Free Software Foundation, Inc. + Copyright (C) 2000-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 2000. diff --git a/libio/tst_wprintf2.c b/libio/tst_wprintf2.c index be0f29f53f..dfff70f1f9 100644 --- a/libio/tst_wprintf2.c +++ b/libio/tst_wprintf2.c @@ -26,7 +26,7 @@ main (int argc, char *argv[]) unlink (name); - setlocale (LC_ALL, ""); + setlocale (LC_ALL, "en_US.UTF-8"); fp = fdopen (dup (fd), "w"); if (fp == NULL) diff --git a/libio/vasprintf.c b/libio/vasprintf.c index 7f9c1050ff..7460f1efe1 100644 --- a/libio/vasprintf.c +++ b/libio/vasprintf.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1995-2015 Free Software Foundation, Inc. +/* Copyright (C) 1995-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -32,10 +32,7 @@ #include "strfile.h" int -_IO_vasprintf (result_ptr, format, args) - char **result_ptr; - const char *format; - _IO_va_list args; +_IO_vasprintf (char **result_ptr, const char *format, _IO_va_list args) { /* Initial size of the buffer to be used. Will be doubled each time an overflow occurs. */ diff --git a/libio/vscanf.c b/libio/vscanf.c index 5a17c1d419..b3a0f11832 100644 --- a/libio/vscanf.c +++ b/libio/vscanf.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993-2015 Free Software Foundation, Inc. +/* Copyright (C) 1993-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -30,9 +30,7 @@ #undef vscanf int -_IO_vscanf (format, args) - const char *format; - _IO_va_list args; +_IO_vscanf (const char *format, _IO_va_list args) { return _IO_vfscanf (_IO_stdin, format, args, NULL); } diff --git a/libio/vsnprintf.c b/libio/vsnprintf.c index e2752d8d84..f1063a17be 100644 --- a/libio/vsnprintf.c +++ b/libio/vsnprintf.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1994-2015 Free Software Foundation, Inc. +/* Copyright (C) 1994-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -30,9 +30,7 @@ static int _IO_strn_overflow (_IO_FILE *fp, int c) __THROW; static int -_IO_strn_overflow (fp, c) - _IO_FILE *fp; - int c; +_IO_strn_overflow (_IO_FILE *fp, int c) { /* When we come to here this means the user supplied buffer is filled. But since we must return the number of characters which @@ -92,11 +90,8 @@ const struct _IO_jump_t _IO_strn_jumps attribute_hidden = int -_IO_vsnprintf (string, maxlen, format, args) - char *string; - _IO_size_t maxlen; - const char *format; - _IO_va_list args; +_IO_vsnprintf (char *string, _IO_size_t maxlen, const char *format, + _IO_va_list args) { _IO_strnfile sf; int ret; diff --git a/libio/vswprintf.c b/libio/vswprintf.c index c10e586b35..b90441ad77 100644 --- a/libio/vswprintf.c +++ b/libio/vswprintf.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1994-2015 Free Software Foundation, Inc. +/* Copyright (C) 1994-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -31,9 +31,7 @@ static wint_t _IO_wstrn_overflow (_IO_FILE *fp, wint_t c) __THROW; static wint_t -_IO_wstrn_overflow (fp, c) - _IO_FILE *fp; - wint_t c; +_IO_wstrn_overflow (_IO_FILE *fp, wint_t c) { /* When we come to here this means the user supplied buffer is filled. But since we must return the number of characters which @@ -91,11 +89,8 @@ const struct _IO_jump_t _IO_wstrn_jumps attribute_hidden = int -_IO_vswprintf (string, maxlen, format, args) - wchar_t *string; - _IO_size_t maxlen; - const wchar_t *format; - _IO_va_list args; +_IO_vswprintf (wchar_t *string, _IO_size_t maxlen, const wchar_t *format, + _IO_va_list args) { _IO_wstrnfile sf; int ret; diff --git a/libio/vwprintf.c b/libio/vwprintf.c index 67a6aeb4b8..b1794a5d71 100644 --- a/libio/vwprintf.c +++ b/libio/vwprintf.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2015 Free Software Foundation, Inc. +/* Copyright (C) 1991-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/libio/vwscanf.c b/libio/vwscanf.c index b9c25f0825..e951ae7baa 100644 --- a/libio/vwscanf.c +++ b/libio/vwscanf.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993-2015 Free Software Foundation, Inc. +/* Copyright (C) 1993-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/libio/wfiledoalloc.c b/libio/wfiledoalloc.c index 12425fd5a7..28c10b6d0d 100644 --- a/libio/wfiledoalloc.c +++ b/libio/wfiledoalloc.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993-2015 Free Software Foundation, Inc. +/* Copyright (C) 1993-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -78,8 +78,7 @@ */ int -_IO_wfile_doallocate (fp) - _IO_FILE *fp; +_IO_wfile_doallocate (_IO_FILE *fp) { _IO_size_t size; wchar_t *p; @@ -95,7 +94,9 @@ _IO_wfile_doallocate (fp) size = fp->_IO_buf_end - fp->_IO_buf_base; if ((fp->_flags & _IO_USER_BUF)) size = (size + sizeof (wchar_t) - 1) / sizeof (wchar_t); - ALLOC_WBUF (p, size * sizeof (wchar_t), EOF); + p = malloc (size * sizeof (wchar_t)); + if (__glibc_unlikely (p == NULL)) + return EOF; _IO_wsetb (fp, p, p + size, 1); return 1; } diff --git a/libio/wfileops.c b/libio/wfileops.c index 99f9c8fe65..df1fbdaf8b 100644 --- a/libio/wfileops.c +++ b/libio/wfileops.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993-2015 Free Software Foundation, Inc. +/* Copyright (C) 1993-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. Written by Ulrich Drepper <drepper@cygnus.com>. Based on the single byte version by Per Bothner <bothner@cygnus.com>. diff --git a/libio/wgenops.c b/libio/wgenops.c index 69f3b95896..9f524aaf2d 100644 --- a/libio/wgenops.c +++ b/libio/wgenops.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993-2015 Free Software Foundation, Inc. +/* Copyright (C) 1993-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. Written by Ulrich Drepper <drepper@cygnus.com>. Based on the single byte version by Per Bothner <bothner@cygnus.com>. @@ -48,9 +48,7 @@ static int save_for_wbackup (_IO_FILE *fp, wchar_t *end_p) __THROW /* Return minimum _pos markers Assumes the current get area is the main get area. */ _IO_ssize_t -_IO_least_wmarker (fp, end_p) - _IO_FILE *fp; - wchar_t *end_p; +_IO_least_wmarker (_IO_FILE *fp, wchar_t *end_p) { _IO_ssize_t least_so_far = end_p - fp->_wide_data->_IO_read_base; struct _IO_marker *mark; @@ -63,8 +61,7 @@ libc_hidden_def (_IO_least_wmarker) /* Switch current get area from backup buffer to (start of) main get area. */ void -_IO_switch_to_main_wget_area (fp) - _IO_FILE *fp; +_IO_switch_to_main_wget_area (_IO_FILE *fp) { wchar_t *tmp; fp->_flags &= ~_IO_IN_BACKUP; @@ -84,8 +81,7 @@ libc_hidden_def (_IO_switch_to_main_wget_area) /* Switch current get area from main get area to (end of) backup area. */ void -_IO_switch_to_wbackup_area (fp) - _IO_FILE *fp; +_IO_switch_to_wbackup_area (_IO_FILE *fp) { wchar_t *tmp; fp->_flags |= _IO_IN_BACKUP; @@ -104,14 +100,10 @@ libc_hidden_def (_IO_switch_to_wbackup_area) void -_IO_wsetb (f, b, eb, a) - _IO_FILE *f; - wchar_t *b; - wchar_t *eb; - int a; +_IO_wsetb (_IO_FILE *f, wchar_t *b, wchar_t *eb, int a) { if (f->_wide_data->_IO_buf_base && !(f->_flags2 & _IO_FLAGS2_USER_WBUF)) - FREE_BUF (f->_wide_data->_IO_buf_base, _IO_wblen (f) * sizeof (wchar_t)); + free (f->_wide_data->_IO_buf_base); f->_wide_data->_IO_buf_base = b; f->_wide_data->_IO_buf_end = eb; if (a) @@ -123,9 +115,7 @@ libc_hidden_def (_IO_wsetb) wint_t -_IO_wdefault_pbackfail (fp, c) - _IO_FILE *fp; - wint_t c; +_IO_wdefault_pbackfail (_IO_FILE *fp, wint_t c) { if (fp->_wide_data->_IO_read_ptr > fp->_wide_data->_IO_read_base && !_IO_in_backup (fp) @@ -188,15 +178,12 @@ libc_hidden_def (_IO_wdefault_pbackfail) void -_IO_wdefault_finish (fp, dummy) - _IO_FILE *fp; - int dummy; +_IO_wdefault_finish (_IO_FILE *fp, int dummy) { struct _IO_marker *mark; if (fp->_wide_data->_IO_buf_base && !(fp->_flags2 & _IO_FLAGS2_USER_WBUF)) { - FREE_BUF (fp->_wide_data->_IO_buf_base, - _IO_wblen (fp) * sizeof (wchar_t)); + free (fp->_wide_data->_IO_buf_base); fp->_wide_data->_IO_buf_base = fp->_wide_data->_IO_buf_end = NULL; } @@ -220,8 +207,7 @@ libc_hidden_def (_IO_wdefault_finish) wint_t -_IO_wdefault_uflow (fp) - _IO_FILE *fp; +_IO_wdefault_uflow (_IO_FILE *fp) { wint_t wch; wch = _IO_UNDERFLOW (fp); @@ -233,9 +219,7 @@ libc_hidden_def (_IO_wdefault_uflow) wint_t -__woverflow (f, wch) - _IO_FILE *f; - wint_t wch; +__woverflow (_IO_FILE *f, wint_t wch) { if (f->_mode == 0) _IO_fwide (f, 1); @@ -245,8 +229,7 @@ libc_hidden_def (__woverflow) wint_t -__wuflow (fp) - _IO_FILE *fp; +__wuflow (_IO_FILE *fp) { if (fp->_mode < 0 || (fp->_mode == 0 && _IO_fwide (fp, 1) != 1)) return WEOF; @@ -276,8 +259,7 @@ __wuflow (fp) libc_hidden_def (__wuflow) wint_t -__wunderflow (fp) - _IO_FILE *fp; +__wunderflow (_IO_FILE *fp) { if (fp->_mode < 0 || (fp->_mode == 0 && _IO_fwide (fp, 1) != 1)) return WEOF; @@ -308,10 +290,7 @@ libc_hidden_def (__wunderflow) _IO_size_t -_IO_wdefault_xsputn (f, data, n) - _IO_FILE *f; - const void *data; - _IO_size_t n; +_IO_wdefault_xsputn (_IO_FILE *f, const void *data, _IO_size_t n) { const wchar_t *s = (const wchar_t *) data; _IO_size_t more = n; @@ -359,10 +338,7 @@ libc_hidden_def (_IO_wdefault_xsputn) _IO_size_t -_IO_wdefault_xsgetn (fp, data, n) - _IO_FILE *fp; - void *data; - _IO_size_t n; +_IO_wdefault_xsgetn (_IO_FILE *fp, void *data, _IO_size_t n) { _IO_size_t more = n; wchar_t *s = (wchar_t*) data; @@ -406,8 +382,7 @@ libc_hidden_def (_IO_wdefault_xsgetn) void -_IO_wdoallocbuf (fp) - _IO_FILE *fp; +_IO_wdoallocbuf (_IO_FILE *fp) { if (fp->_wide_data->_IO_buf_base) return; @@ -421,12 +396,13 @@ libc_hidden_def (_IO_wdoallocbuf) int -_IO_wdefault_doallocate (fp) - _IO_FILE *fp; +_IO_wdefault_doallocate (_IO_FILE *fp) { wchar_t *buf; - ALLOC_WBUF (buf, _IO_BUFSIZ, EOF); + buf = malloc (_IO_BUFSIZ); + if (__glibc_unlikely (buf == NULL)) + return EOF; _IO_wsetb (fp, buf, buf + _IO_BUFSIZ, 1); return 1; } @@ -434,8 +410,7 @@ libc_hidden_def (_IO_wdefault_doallocate) int -_IO_switch_to_wget_mode (fp) - _IO_FILE *fp; +_IO_switch_to_wget_mode (_IO_FILE *fp) { if (fp->_wide_data->_IO_write_ptr > fp->_wide_data->_IO_write_base) if ((wint_t)_IO_WOVERFLOW (fp, WEOF) == WEOF) @@ -459,8 +434,7 @@ _IO_switch_to_wget_mode (fp) libc_hidden_def (_IO_switch_to_wget_mode) void -_IO_free_wbackup_area (fp) - _IO_FILE *fp; +_IO_free_wbackup_area (_IO_FILE *fp) { if (_IO_in_backup (fp)) _IO_switch_to_main_wget_area (fp); /* Just in case. */ @@ -473,8 +447,7 @@ libc_hidden_def (_IO_free_wbackup_area) #if 0 int -_IO_switch_to_wput_mode (fp) - _IO_FILE *fp; +_IO_switch_to_wput_mode (_IO_FILE *fp) { fp->_wide_data->_IO_write_base = fp->_wide_data->_IO_read_ptr; fp->_wide_data->_IO_write_ptr = fp->_wide_data->_IO_read_ptr; @@ -496,9 +469,7 @@ static int #ifdef _LIBC internal_function #endif -save_for_wbackup (fp, end_p) - _IO_FILE *fp; - wchar_t *end_p; +save_for_wbackup (_IO_FILE *fp, wchar_t *end_p) { /* Append [_IO_read_base..end_p] to backup area. */ _IO_ssize_t least_mark = _IO_least_wmarker (fp, end_p); @@ -593,9 +564,7 @@ save_for_wbackup (fp, end_p) } wint_t -_IO_sputbackwc (fp, c) - _IO_FILE *fp; - wint_t c; +_IO_sputbackwc (_IO_FILE *fp, wint_t c) { wint_t result; @@ -616,8 +585,7 @@ _IO_sputbackwc (fp, c) libc_hidden_def (_IO_sputbackwc) wint_t -_IO_sungetwc (fp) - _IO_FILE *fp; +_IO_sungetwc (_IO_FILE *fp) { wint_t result; @@ -637,10 +605,7 @@ _IO_sungetwc (fp) unsigned -_IO_adjust_wcolumn (start, line, count) - unsigned start; - const wchar_t *line; - int count; +_IO_adjust_wcolumn (unsigned start, const wchar_t *line, int count) { const wchar_t *ptr = line + count; while (ptr > line) @@ -650,9 +615,7 @@ _IO_adjust_wcolumn (start, line, count) } void -_IO_init_wmarker (marker, fp) - struct _IO_marker *marker; - _IO_FILE *fp; +_IO_init_wmarker (struct _IO_marker *marker, _IO_FILE *fp) { marker->_sbuf = fp; if (_IO_in_put_mode (fp)) @@ -672,8 +635,7 @@ _IO_init_wmarker (marker, fp) /* Return difference between MARK and current position of MARK's stream. */ int -_IO_wmarker_delta (mark) - struct _IO_marker *mark; +_IO_wmarker_delta (struct _IO_marker *mark) { int cur_pos; if (mark->_sbuf == NULL) @@ -688,10 +650,7 @@ _IO_wmarker_delta (mark) } int -_IO_seekwmark (fp, mark, delta) - _IO_FILE *fp; - struct _IO_marker *mark; - int delta; +_IO_seekwmark (_IO_FILE *fp, struct _IO_marker *mark, int delta) { if (mark->_sbuf != fp) return EOF; @@ -712,8 +671,7 @@ _IO_seekwmark (fp, mark, delta) } void -_IO_unsave_wmarkers (fp) - _IO_FILE *fp; +_IO_unsave_wmarkers (_IO_FILE *fp) { struct _IO_marker *mark = fp->_markers; if (mark) diff --git a/libio/wmemstream.c b/libio/wmemstream.c index 61b5d8b346..1bdbae9fe8 100644 --- a/libio/wmemstream.c +++ b/libio/wmemstream.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1995-2015 Free Software Foundation, Inc. +/* Copyright (C) 1995-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -62,9 +62,7 @@ static const struct _IO_jump_t _IO_wmem_jumps = necessary. *BUFLOC and *SIZELOC are updated with the buffer's location and the number of characters written on fflush or fclose. */ _IO_FILE * -open_wmemstream (bufloc, sizeloc) - wchar_t **bufloc; - _IO_size_t *sizeloc; +open_wmemstream (wchar_t **bufloc, _IO_size_t *sizeloc) { struct locked_FILE { @@ -105,8 +103,7 @@ open_wmemstream (bufloc, sizeloc) static int -_IO_wmem_sync (fp) - _IO_FILE* fp; +_IO_wmem_sync (_IO_FILE *fp) { struct _IO_FILE_wmemstream *mp = (struct _IO_FILE_wmemstream *) fp; @@ -127,9 +124,7 @@ _IO_wmem_sync (fp) static void -_IO_wmem_finish (fp, dummy) - _IO_FILE* fp; - int dummy; +_IO_wmem_finish (_IO_FILE *fp, int dummy) { struct _IO_FILE_wmemstream *mp = (struct _IO_FILE_wmemstream *) fp; diff --git a/libio/wprintf.c b/libio/wprintf.c index f0f467625a..8b0e843a1a 100644 --- a/libio/wprintf.c +++ b/libio/wprintf.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2015 Free Software Foundation, Inc. +/* Copyright (C) 1991-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/libio/wscanf.c b/libio/wscanf.c index a0d92f2c92..739399bf8a 100644 --- a/libio/wscanf.c +++ b/libio/wscanf.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2015 Free Software Foundation, Inc. +/* Copyright (C) 1991-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/libio/wstrops.c b/libio/wstrops.c index 3993579bd1..2b9d0368f3 100644 --- a/libio/wstrops.c +++ b/libio/wstrops.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993-2015 Free Software Foundation, Inc. +/* Copyright (C) 1993-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -32,11 +32,8 @@ #include <stdio_ext.h> void -_IO_wstr_init_static (fp, ptr, size, pstart) - _IO_FILE *fp; - wchar_t *ptr; - _IO_size_t size; - wchar_t *pstart; +_IO_wstr_init_static (_IO_FILE *fp, wchar_t *ptr, _IO_size_t size, + wchar_t *pstart) { wchar_t *end; @@ -70,9 +67,7 @@ _IO_wstr_init_static (fp, ptr, size, pstart) } _IO_wint_t -_IO_wstr_overflow (fp, c) - _IO_FILE *fp; - _IO_wint_t c; +_IO_wstr_overflow (_IO_FILE *fp, _IO_wint_t c) { int flush_only = c == WEOF; _IO_size_t pos; @@ -142,8 +137,7 @@ _IO_wstr_overflow (fp, c) _IO_wint_t -_IO_wstr_underflow (fp) - _IO_FILE *fp; +_IO_wstr_underflow (_IO_FILE *fp) { if (fp->_wide_data->_IO_write_ptr > fp->_wide_data->_IO_read_end) fp->_wide_data->_IO_read_end = fp->_wide_data->_IO_write_ptr; @@ -162,8 +156,7 @@ _IO_wstr_underflow (fp) /* The size of the valid part of the buffer. */ _IO_ssize_t -_IO_wstr_count (fp) - _IO_FILE *fp; +_IO_wstr_count (_IO_FILE *fp) { struct _IO_wide_data *wd = fp->_wide_data; @@ -244,11 +237,7 @@ enlarge_userbuf (_IO_FILE *fp, _IO_off64_t offset, int reading) _IO_off64_t -_IO_wstr_seekoff (fp, offset, dir, mode) - _IO_FILE *fp; - _IO_off64_t offset; - int dir; - int mode; +_IO_wstr_seekoff (_IO_FILE *fp, _IO_off64_t offset, int dir, int mode) { _IO_off64_t new_pos; @@ -326,9 +315,7 @@ _IO_wstr_seekoff (fp, offset, dir, mode) } _IO_wint_t -_IO_wstr_pbackfail (fp, c) - _IO_FILE *fp; - _IO_wint_t c; +_IO_wstr_pbackfail (_IO_FILE *fp, _IO_wint_t c) { if ((fp->_flags & _IO_NO_WRITES) && c != WEOF) return WEOF; @@ -336,9 +323,7 @@ _IO_wstr_pbackfail (fp, c) } void -_IO_wstr_finish (fp, dummy) - _IO_FILE *fp; - int dummy; +_IO_wstr_finish (_IO_FILE *fp, int dummy) { if (fp->_wide_data->_IO_buf_base && !(fp->_flags2 & _IO_FLAGS2_USER_WBUF)) (((_IO_strfile *) fp)->_s._free_buffer) (fp->_wide_data->_IO_buf_base); |