Remove macro definition of rewind() which does not clear the IO error indicator.

Now rewind() will always be called as a function. In combination with an update to the rewind() function in ORCALib, this will ensure that the error indicator is always cleared, as required by the C standards.
This commit is contained in:
Stephen Heumann 2022-06-24 18:32:08 -05:00
parent c987f240c6
commit 06bf0c5f46
2 changed files with 3 additions and 10 deletions

View File

@ -99,16 +99,6 @@ extern FILE *stdout;
typedef long fpos_t; typedef long fpos_t;
/*
* Function declared as a macro
*/
void rewind(FILE *);
#define rewind(stream) (__fseek((stream),0L,SEEK_SET))
/* Private function used in the above macro (not to be used otherwise) */
int __fseek(FILE *, long, int);
/* /*
* Function declarations * Function declarations
*/ */
@ -142,6 +132,7 @@ int putchar(int);
int puts(const char *); int puts(const char *);
int remove(const char *); int remove(const char *);
int rename(const char *, const char *); int rename(const char *, const char *);
void rewind(FILE *);
int scanf(const char *, ...); int scanf(const char *, ...);
void setbuf(FILE *, char *); void setbuf(FILE *, char *);
int setvbuf(FILE *, char *, int, size_t); int setvbuf(FILE *, char *, int, size_t);

View File

@ -1829,6 +1829,8 @@ int foo(int[42]);
(Jay Krell, Devin Reade) (Jay Krell, Devin Reade)
190. Calling rewind() should clear the I/O error indicator for the stream (the value returned by ferror()), but it was not doing so.
-- Bugs from C 2.1.0 that have been fixed ----------------------------------- -- Bugs from C 2.1.0 that have been fixed -----------------------------------
1. In some situations, fread() reread the first 1K or so of the file. 1. In some situations, fread() reread the first 1K or so of the file.