[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] Don't error out if stdin/stdout/stderr was already closed.
From: |
Jim Meyering |
Subject: |
Re: [PATCH] Don't error out if stdin/stdout/stderr was already closed. |
Date: |
Sun, 11 Apr 2010 16:50:56 +0200 |
Jim Meyering wrote:
> James Youngman wrote:
...
>> * lib/close-stream.c (close_stream): Make boolean variables const
>> to document the fact that we set but do not change them.
...
> However, the const-adding part of your patch would be find all by itself.
I've pushed this in your name:
>From 1e47f69a052a8db2db332d55044b31f61a87c0ec Mon Sep 17 00:00:00 2001
From: James Youngman <address@hidden>
Date: Sun, 11 Apr 2010 16:48:21 +0200
Subject: [PATCH] close-stream: declare local scalars to be "const"
* lib/close-stream.c (close_stream): Make boolean variables const
to document the fact that we set but do not change them.
---
ChangeLog | 6 ++++++
lib/close-stream.c | 6 +++---
2 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 0ee4f00..6a39d27 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2010-04-11 James Youngman <address@hidden>
+
+ close-stream: declare local scalars to be "const"
+ * lib/close-stream.c (close_stream): Make boolean variables const
+ to document the fact that we set but do not change them.
+
2010-04-11 Jim Meyering <address@hidden>
maint.mk: don't include dist-check.mk
diff --git a/lib/close-stream.c b/lib/close-stream.c
index cf0422f..87a59e4 100644
--- a/lib/close-stream.c
+++ b/lib/close-stream.c
@@ -55,9 +55,9 @@
int
close_stream (FILE *stream)
{
- bool some_pending = (__fpending (stream) != 0);
- bool prev_fail = (ferror (stream) != 0);
- bool fclose_fail = (fclose (stream) != 0);
+ const bool some_pending = (__fpending (stream) != 0);
+ const bool prev_fail = (ferror (stream) != 0);
+ const bool fclose_fail = (fclose (stream) != 0);
/* Return an error indication if there was a previous failure or if
fclose failed, with one exception: ignore an fclose failure if
--
1.7.1.rc1.237.ge1730
- [PATCH] Don't error out if stdin/stdout/stderr was already closed., James Youngman, 2010/04/11
- Re: [PATCH] Don't error out if stdin/stdout/stderr was already closed., Jim Meyering, 2010/04/11
- Re: const local variables, Bruno Haible, 2010/04/11
- Re: const local variables, James Youngman, 2010/04/11
- Re: const local variables, Jim Meyering, 2010/04/11
- Re: const local variables, Paul Eggert, 2010/04/11
- "const" scalars, Jim Meyering, 2010/04/12
- Re: "const" scalars, Ben Pfaff, 2010/04/12
- Re: "const" scalars, Jim Meyering, 2010/04/12
- Re: "const" scalars, Paul Eggert, 2010/04/12
- Re: const local variables, Ludovic Courtès, 2010/04/12