From bfb929f4a7e127a92526946a22fb5ca04eeb5a87 Mon Sep 17 00:00:00 2001 From: Stephen Heumann Date: Sun, 12 Nov 2017 23:57:28 -0600 Subject: [PATCH] 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. --- ORCACDefs/stdio.h | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/ORCACDefs/stdio.h b/ORCACDefs/stdio.h index 679e9cb..fa301a7 100644 --- a/ORCACDefs/stdio.h +++ b/ORCACDefs/stdio.h @@ -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 *, ...);