On Fri, Jan 3, 2014 at 3:17 PM, Jim Meyering <j...@meyering.net> wrote:
> On Fri, Jan 3, 2014 at 3:13 PM, Bruno Haible <br...@clisp.org> wrote:
> ...
>> stream is accessed from different threads. Therefore OK for the change.
>>
>> But all of the functions
>>   freadable
>>   freadahead
>>   freading
>>   fwritable
>>   fwriting
>> are similar enough that they should be treated the same way. Can you add the
>> '__pure__' attribute also the other 4 functions as well?
>
> Hi Bruno (and happy new year! :-)
> Thanks for the review.  Yes, I'll do that.

freadahead was already done, so that left three:
From 34af3d3fd03a60d19c3fde90bbb350d5567fec66 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyer...@fb.com>
Date: Fri, 3 Jan 2014 17:17:27 -0800
Subject: [PATCH] freadable, fwritable, fwriting: declare with the "pure"
 attribute

* lib/freadable.h (freadable): Declare with the "pure" attribute.
* lib/fwritable.h (fwritable): Likewise.
* lib/fwriting.h (fwriting): Likewise.
Suggested by Bruno Haible.
---
 ChangeLog       | 6 ++++++
 lib/freadable.h | 2 +-
 lib/fwritable.h | 2 +-
 lib/fwriting.h  | 2 +-
 4 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index a73c962..278e656 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2014-01-03  Jim Meyering  <meyer...@fb.com>

+       freadable, fwritable, fwriting: declare with the "pure" attribute
+       * lib/freadable.h (freadable): Declare with the "pure" attribute.
+       * lib/fwritable.h (fwritable): Likewise.
+       * lib/fwriting.h (fwriting): Likewise.
+       Suggested by Bruno Haible.
+
        maint.mk: adapt openat.h-include-without-use test
        * top/maint.mk (sc_prohibit_openat_without_use): Also check for
        FCHMODAT_INLINE, FCHOWNAT_INLINE and STATAT_INLINE, to avoid
diff --git a/lib/freadable.h b/lib/freadable.h
index 0b8ad42..0455558 100644
--- a/lib/freadable.h
+++ b/lib/freadable.h
@@ -33,7 +33,7 @@
 extern "C" {
 # endif

-extern bool freadable (FILE *stream);
+extern bool freadable (FILE *stream) _GL_ATTRIBUTE_PURE;

 # ifdef __cplusplus
 }
diff --git a/lib/fwritable.h b/lib/fwritable.h
index c42cb66..6b7f0d2 100644
--- a/lib/fwritable.h
+++ b/lib/fwritable.h
@@ -33,7 +33,7 @@
 extern "C" {
 # endif

-extern bool fwritable (FILE *stream);
+extern bool fwritable (FILE *stream) _GL_ATTRIBUTE_PURE;

 # ifdef __cplusplus
 }
diff --git a/lib/fwriting.h b/lib/fwriting.h
index c4a913a..b4a9b0d 100644
--- a/lib/fwriting.h
+++ b/lib/fwriting.h
@@ -44,7 +44,7 @@
 extern "C" {
 # endif

-extern bool fwriting (FILE *stream);
+extern bool fwriting (FILE *stream) _GL_ATTRIBUTE_PURE;

 # ifdef __cplusplus
 }
-- 
1.8.5.2.229.g4448466

Reply via email to