Remove the setbuf macro in favor of just calling the library function.
The macro was slightly broken in that its 'buf' argument might be evaluated twice. This could be a problem if it was, e.g., a call to an allocation function.
This commit is contained in:
parent
dedd50c81e
commit
bfb929f4a7
|
@ -100,17 +100,13 @@ extern FILE *stdout;
|
|||
typedef long fpos_t;
|
||||
|
||||
/*
|
||||
* Functions declared as macros
|
||||
* Function declared as a macro
|
||||
*/
|
||||
|
||||
void setbuf(FILE *, char *);
|
||||
void rewind(FILE *);
|
||||
|
||||
#define setbuf(stream,buf) ((buf==NULL) ? (void) __setvbuf(stream,NULL,_IONBF,0l) : (void) __setvbuf(stream,buf,_IOFBF,(size_t) BUFSIZ))
|
||||
#define rewind(stream) (__fseek((stream),0L,SEEK_SET))
|
||||
|
||||
/* Private functions used in the above macros (not to be used otherwise) */
|
||||
int __setvbuf(FILE *, char *, int, size_t);
|
||||
/* Private function used in the above macro (not to be used otherwise) */
|
||||
int __fseek(FILE *, long, int);
|
||||
|
||||
/*
|
||||
|
@ -147,6 +143,7 @@ int puts(const char *);
|
|||
int remove(const char *);
|
||||
int rename(const char *, const char *);
|
||||
int scanf(const char *, ...);
|
||||
void setbuf(FILE *, char *);
|
||||
int setvbuf(FILE *, char *, int, size_t);
|
||||
int sprintf(char *, const char *, ...);
|
||||
int sscanf(const char *, const char *, ...);
|
||||
|
|
Loading…
Reference in New Issue