Skip to content
Snippets Groups Projects
Commit 07a0cc3e authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Add FCLOSE_OPEN_FILE to close a FILE*, if it's open (non-NULL), and NULLify it

Change CLOSE_OPEN_FILE to a do/while(0) to eliminate extraneous semicolon
parent 5546278f
No related branches found
No related tags found
1 merge request!463MRC mods by Codefenix (2024-10-20)
......@@ -150,7 +150,8 @@
#define O_DENYNONE SH_DENYNO
#endif
#define CLOSE_OPEN_FILE(x) while((x) >= 0) { close(x); (x)=-1; break; }
#define CLOSE_OPEN_FILE(x) do { if((x) >= 0) { close(x); (x) = -1; } } while(0)
#define FCLOSE_OPEN_FILE(x) do { if((x) != NULL) { fclose(x); (x) = NULL; } } while(0)
/**************/
/* Prototypes */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment