Mercurial > hg > octave-nkf > gnulib-hg
changeset 11653:ecb384fccb5b
fpurge: migrate into <stdio.h>
* lib/fpurge.h: Delete...
* lib/stdio.in.h (fpurge): ...and declare here, instead.
* lib/fpurge.c (fpurge): Change declaring header.
* modules/fpurge (Files): Drop deleted file.
(Depends-on): Add stdio.
(configure.ac): Set witness.
* modules/stdio (Makefile.am): Support fpurge macros.
* m4/stdio_h.m4 (gl_STDIO_H_DEFAULTS): Likewise.
* m4/fpurge.m4 (gl_FUNC_FPURGE): Set appropriate variables.
* lib/fflush.c: Update client.
* tests/test-fpurge.c: Likewise.
* NEWS: Mention the change.
Signed-off-by: Eric Blake <ebb9@byu.net>
author | Eric Blake <ebb9@byu.net> |
---|---|
date | Wed, 24 Jun 2009 06:49:00 -0600 |
parents | 7c297f566e07 |
children | 22347e3d6b95 |
files | ChangeLog NEWS lib/fflush.c lib/fpurge.c lib/fpurge.h lib/stdio.in.h m4/fpurge.m4 m4/stdio_h.m4 modules/fpurge modules/stdio tests/test-fpurge.c |
diffstat | 11 files changed, 62 insertions(+), 50 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,19 @@ +2009-06-25 Eric Blake <ebb9@byu.net> + + fpurge: migrate into <stdio.h> + * lib/fpurge.h: Delete... + * lib/stdio.in.h (fpurge): ...and declare here, instead. + * lib/fpurge.c (fpurge): Change declaring header. + * modules/fpurge (Files): Drop deleted file. + (Depends-on): Add stdio. + (configure.ac): Set witness. + * modules/stdio (Makefile.am): Support fpurge macros. + * m4/stdio_h.m4 (gl_STDIO_H_DEFAULTS): Likewise. + * m4/fpurge.m4 (gl_FUNC_FPURGE): Set appropriate variables. + * lib/fflush.c: Update client. + * tests/test-fpurge.c: Likewise. + * NEWS: Mention the change. + 2009-06-25 Sergey Poznyakoff <gray@gnu.org.ua> * lib/argp-version-etc.c (program_authors): Add const
--- a/NEWS +++ b/NEWS @@ -6,6 +6,9 @@ Date Modules Changes +2009-06-25 fpurge The include file is changed from "fpurge.h" to + <stdio.h>. + 2009-04-26 modules/uniconv/u8-conv-from-enc modules/uniconv/u16-conv-from-enc modules/uniconv/u32-conv-from-enc
--- a/lib/fflush.c +++ b/lib/fflush.c @@ -25,7 +25,6 @@ #include <unistd.h> #include "freading.h" -#include "fpurge.h" #include "stdio-impl.h"
--- a/lib/fpurge.c +++ b/lib/fpurge.c @@ -17,7 +17,7 @@ #include <config.h> /* Specification. */ -#include "fpurge.h" +#include <stdio.h> #if HAVE___FPURGE /* glibc >= 2.2, Haiku, Solaris >= 7 */ # include <stdio_ext.h>
deleted file mode 100644 --- a/lib/fpurge.h +++ /dev/null @@ -1,38 +0,0 @@ -/* Flushing buffers of a FILE stream. - Copyright (C) 2007 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 - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ - -#ifndef _GL_FPURGE_H -#define _GL_FPURGE_H - -#include <stdio.h> - -#ifdef __cplusplus -extern "C" { -#endif - -/* Discard all pending buffered I/O on the stream STREAM. - STREAM must not be wide-character oriented. - Return 0 if successful. Upon error, return -1 and set errno. */ -#if HAVE_FPURGE -# define fpurge rpl_fpurge -#endif -extern int fpurge (FILE *stream); - -#ifdef __cplusplus -} -#endif - -#endif /* _GL_FPURGE_H */
--- a/lib/stdio.in.h +++ b/lib/stdio.in.h @@ -1,6 +1,6 @@ /* A GNU-like <stdio.h>. - Copyright (C) 2004, 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2004, 2007-2009 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 @@ -407,6 +407,24 @@ fflush (f)) #endif +#if @GNULIB_FPURGE@ +# if @REPLACE_FPURGE@ +# define fpurge rpl_fpurge +# endif +# if @REPLACE_FPURGE@ || !@HAVE_DECL_FPURGE@ + /* Discard all pending buffered I/O data on STREAM. + STREAM must not be wide-character oriented. + Return 0 if successful. Upon error, return -1 and set errno. */ + extern int fpurge (FILE *gl_stream); +# endif +#elif defined GNULIB_POSIXCHECK +# undef fpurge +# define fpurge(f) \ + (GL_LINK_WARNING ("fpurge is not always present - " \ + "use gnulib module fpurge for portability"), \ + fpurge (f)) +#endif + #if @GNULIB_FCLOSE@ # if @REPLACE_FCLOSE@ # define fclose rpl_fclose
--- a/m4/fpurge.m4 +++ b/m4/fpurge.m4 @@ -1,12 +1,20 @@ -# fpurge.m4 serial 2 -dnl Copyright (C) 2007 Free Software Foundation, Inc. +# fpurge.m4 serial 3 +dnl Copyright (C) 2007, 2009 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_FPURGE], [ + AC_REQUIRE([gl_STDIO_H_DEFAULTS]) AC_CHECK_FUNCS_ONCE([fpurge]) AC_CHECK_FUNCS_ONCE([__fpurge]) - AC_CHECK_DECLS([fpurge], , , [#include <stdio.h>]) + AC_CHECK_DECLS([fpurge], , , [[#include <stdio.h>]]) + dnl For now, lib/fpurge.c is always compiled. + if test "x$ac_cv_func_fpurge" = xyes; then + REPLACE_FPURGE=1 + fi + if test "x$ac_cv_have_decl_fpurge" = xno; then + HAVE_DECL_FPURGE=0 + fi ])
--- a/m4/stdio_h.m4 +++ b/m4/stdio_h.m4 @@ -1,4 +1,4 @@ -# stdio_h.m4 serial 15 +# stdio_h.m4 serial 16 dnl Copyright (C) 2007-2009 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -65,6 +65,7 @@ GNULIB_FTELL=0; AC_SUBST([GNULIB_FTELL]) GNULIB_FTELLO=0; AC_SUBST([GNULIB_FTELLO]) GNULIB_FFLUSH=0; AC_SUBST([GNULIB_FFLUSH]) + GNULIB_FPURGE=0; AC_SUBST([GNULIB_FPURGE]) GNULIB_FCLOSE=0; AC_SUBST([GNULIB_FCLOSE]) GNULIB_FPUTC=0; AC_SUBST([GNULIB_FPUTC]) GNULIB_PUTC=0; AC_SUBST([GNULIB_PUTC]) @@ -105,6 +106,8 @@ REPLACE_FTELLO=0; AC_SUBST([REPLACE_FTELLO]) REPLACE_FTELL=0; AC_SUBST([REPLACE_FTELL]) REPLACE_FFLUSH=0; AC_SUBST([REPLACE_FFLUSH]) + REPLACE_FPURGE=0; AC_SUBST([REPLACE_FPURGE]) + HAVE_DECL_FPURGE=1; AC_SUBST([HAVE_DECL_FPURGE]) REPLACE_FCLOSE=0; AC_SUBST([REPLACE_FCLOSE]) HAVE_DECL_GETDELIM=1; AC_SUBST([HAVE_DECL_GETDELIM]) HAVE_DECL_GETLINE=1; AC_SUBST([HAVE_DECL_GETLINE])
--- a/modules/fpurge +++ b/modules/fpurge @@ -2,21 +2,22 @@ fpurge() function: Flush buffers. Files: -lib/fpurge.h lib/fpurge.c lib/stdio-impl.h m4/fpurge.m4 Depends-on: +stdio configure.ac: gl_FUNC_FPURGE +gl_STDIO_MODULE_INDICATOR([fpurge]) Makefile.am: lib_SOURCES += fpurge.c Include: -"fpurge.h" +<stdio.h> License: LGPL
--- a/modules/stdio +++ b/modules/stdio @@ -49,6 +49,7 @@ -e 's|@''GNULIB_FTELL''@|$(GNULIB_FTELL)|g' \ -e 's|@''GNULIB_FTELLO''@|$(GNULIB_FTELLO)|g' \ -e 's|@''GNULIB_FFLUSH''@|$(GNULIB_FFLUSH)|g' \ + -e 's|@''GNULIB_FPURGE''@|$(GNULIB_FPURGE)|g' \ -e 's|@''GNULIB_FCLOSE''@|$(GNULIB_FCLOSE)|g' \ -e 's|@''GNULIB_FPUTC''@|$(GNULIB_FPUTC)|g' \ -e 's|@''GNULIB_PUTC''@|$(GNULIB_PUTC)|g' \ @@ -86,6 +87,8 @@ -e 's|@''REPLACE_FTELLO''@|$(REPLACE_FTELLO)|g' \ -e 's|@''REPLACE_FTELL''@|$(REPLACE_FTELL)|g' \ -e 's|@''REPLACE_FFLUSH''@|$(REPLACE_FFLUSH)|g' \ + -e 's|@''REPLACE_FPURGE''@|$(REPLACE_FPURGE)|g' \ + -e 's|@''HAVE_DECL_FPURGE''@|$(HAVE_DECL_FPURGE)|g' \ -e 's|@''REPLACE_FCLOSE''@|$(REPLACE_FCLOSE)|g' \ -e 's|@''HAVE_DECL_GETDELIM''@|$(HAVE_DECL_GETDELIM)|g' \ -e 's|@''HAVE_DECL_GETLINE''@|$(HAVE_DECL_GETLINE)|g' \
--- a/tests/test-fpurge.c +++ b/tests/test-fpurge.c @@ -1,5 +1,5 @@ /* Test of fpurge() function. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 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 @@ -18,9 +18,8 @@ #include <config.h> -#include "fpurge.h" +#include <stdio.h> -#include <stdio.h> #include <stdlib.h> #include <string.h>