diff options
author | Alex O'Brien <3541ax@gmail.com> | 2022-03-06 20:50:19 +1100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-03-06 13:00:42 +0100 |
commit | ad1065e213dddc0fc2bbb94a5522dd7cf75b637a (patch) | |
tree | 01d7c7e6c8ce5bb1ae564cd89ed8853dd500d3b3 /Userland/Libraries/LibC/fd_set.h | |
parent | 7d5d5b387eaf253d1ee55a2edda82842c9713eb0 (diff) | |
download | serenity-ad1065e213dddc0fc2bbb94a5522dd7cf75b637a.zip |
LibC: Remove semicolon in definition of FD_ZERO
This causes problems in code of the form
if (/* condition */)
FD_ZERO(&thing);
else
do_other_thing();
Wrapping the call to memset() in a do/while block fixes the issue.
Diffstat (limited to 'Userland/Libraries/LibC/fd_set.h')
-rw-r--r-- | Userland/Libraries/LibC/fd_set.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Userland/Libraries/LibC/fd_set.h b/Userland/Libraries/LibC/fd_set.h index 5a6379acaa..74079d9304 100644 --- a/Userland/Libraries/LibC/fd_set.h +++ b/Userland/Libraries/LibC/fd_set.h @@ -7,7 +7,10 @@ #pragma once #define FD_SETSIZE 1024 -#define FD_ZERO(set) memset((set), 0, sizeof(fd_set)); +#define FD_ZERO(set) \ + do { \ + memset((set), 0, sizeof(fd_set)); \ + } while (0) #define FD_CLR(fd, set) ((set)->fds_bits[(fd / 8)] &= ~(1 << (fd) % 8)) #define FD_SET(fd, set) ((set)->fds_bits[(fd / 8)] |= (1 << (fd) % 8)) #define FD_ISSET(fd, set) ((set)->fds_bits[(fd / 8)] & (1 << (fd) % 8)) |