use idiomatic safe form for FUNLOCK macro

previously this macro used an odd if/else form instead of the more
idiomatic do/while(0), making it unsafe against omission of trailing
semicolon. the omission would make the following statement conditional
instead of producing an error.
This commit is contained in:
Rich Felker 2018-02-24 12:33:06 -05:00
parent 7c59d09863
commit 455bd82445
1 changed files with 1 additions and 1 deletions

View File

@ -9,7 +9,7 @@
#define FFINALLOCK(f) ((f)->lock>=0 ? __lockfile((f)) : 0)
#define FLOCK(f) int __need_unlock = ((f)->lock>=0 ? __lockfile((f)) : 0)
#define FUNLOCK(f) if (__need_unlock) __unlockfile((f)); else
#define FUNLOCK(f) do { if (__need_unlock) __unlockfile((f)); } while (0)
#define F_PERM 1
#define F_NORD 4