mirror of git://git.musl-libc.org/musl
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:
parent
7c59d09863
commit
455bd82445
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue