[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: musl compatibility
From: |
Paul Eggert |
Subject: |
Re: musl compatibility |
Date: |
Tue, 12 Jun 2012 08:30:42 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:12.0) Gecko/20120430 Thunderbird/12.0.1 |
On 06/12/2012 04:21 AM, Paolo Bonzini wrote:
> perhaps we can follow the suggestion and
> replace "if (freadahead (f))" with "if (freading(f) && !feof(f))" in
> closein.c.
Yes, thanks, I like this idea the best of those suggested so far.
Here's a proposed patch to gnulib.
>From 43f704124bc3a96dc19146408285747fecf057bb Mon Sep 17 00:00:00 2001
From: Paul Eggert <address@hidden>
Date: Tue, 12 Jun 2012 08:28:29 -0700
Subject: [PATCH] closein: port to musl, which lacks freadahead
Suggested by Paolo Bonzini in
<http://lists.gnu.org/archive/html/bug-gnulib/2012-06/msg00103.html>.
* lib/closein.c: Include freading.h rather than freadahead.h.
(close_stdin): Use freading and feof, not freadhead, to decide
whether there is buffered input.
* modules/closein (Depends-on): Depend on freading, not freadahead.
---
ChangeLog | 10 ++++++++++
lib/closein.c | 4 ++--
modules/closein | 2 +-
3 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index ecff180..206178b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2012-06-12 Paul Eggert <address@hidden>
+
+ closein: port to musl, which lacks freadahead
+ Suggested by Paolo Bonzini in
+ <http://lists.gnu.org/archive/html/bug-gnulib/2012-06/msg00103.html>.
+ * lib/closein.c: Include freading.h rather than freadahead.h.
+ (close_stdin): Use freading and feof, not freadhead, to decide
+ whether there is buffered input.
+ * modules/closein (Depends-on): Depend on freading, not freadahead.
+
2012-06-12 Akim Demaille <address@hidden>
announce-gen: VPATH issues
diff --git a/lib/closein.c b/lib/closein.c
index 65f2cb9..b910575 100644
--- a/lib/closein.c
+++ b/lib/closein.c
@@ -31,7 +31,7 @@
#include "closeout.h"
#include "error.h"
#include "exitfail.h"
-#include "freadahead.h"
+#include "freading.h"
#include "quotearg.h"
static const char *file_name;
@@ -84,7 +84,7 @@ close_stdin (void)
input buffer is empty; in this case we know that if stdin is seekable,
(fseeko (stdin, 0, SEEK_CUR), ftello (stdin))
== lseek (0, 0, SEEK_CUR). */
- if (freadahead (stdin) > 0)
+ if (freading (stdin) && !feof (stdin))
{
/* Only attempt flush if stdin is seekable, as fflush is entitled to
fail on non-seekable streams. */
diff --git a/modules/closein b/modules/closein
index 5f6e7d7..0905f5b 100644
--- a/modules/closein
+++ b/modules/closein
@@ -8,7 +8,7 @@ m4/closein.m4
Depends-on:
closeout
-freadahead
+freading
fflush
stdbool
--
1.7.6.5
- musl compatibility, Reuben Thomas, 2012/06/07
- Re: musl compatibility, Pedro Alves, 2012/06/08
- Re: musl compatibility, Reuben Thomas, 2012/06/08
- Re: musl compatibility, Paolo Bonzini, 2012/06/12
- Re: musl compatibility,
Paul Eggert <=
- Re: musl compatibility, Bruno Haible, 2012/06/17
- Re: musl compatibility, Paolo Bonzini, 2012/06/23
- Re: musl compatibility, Paul Eggert, 2012/06/23