diff options
author | Ben Pfaff <blp@nicira.com> | 2013-07-29 15:24:45 -0700 |
---|---|---|
committer | Ben Pfaff <blp@nicira.com> | 2013-07-29 15:24:45 -0700 |
commit | 5453ae2067671c0d40a5b3ac3cb3d4027bed6abb (patch) | |
tree | f797fc5637955f401f5bee32c578085d31697bdc /lib/latch.c | |
parent | 74cc3969aff34f24c093905c427471ebfb219f0c (diff) |
Avoid C preprocessor trick where macro has the same name as a function.
In C, one can do preprocessor tricks by making a macro expansion include
the macro's own name. We actually used this in the tree to automatically
provide function arguments, e.g.:
int f(int x, const char *file, int line);
#define f(x) f(x, __FILE__, __LINE__)
...
f(1); /* Expands to a call like f(1, __FILE__, __LINE__); */
However it's somewhat confusing, so this commit stops using that trick.
Reported-by: Ed Maste <emaste@freebsd.org>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ed Maste <emaste@freebsd.org>
Diffstat (limited to 'lib/latch.c')
-rw-r--r-- | lib/latch.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/latch.c b/lib/latch.c index 9b130062..bf518b9c 100644 --- a/lib/latch.c +++ b/lib/latch.c @@ -75,9 +75,13 @@ latch_is_set(const struct latch *latch) return pfd.revents & POLLIN; } -/* Causes the next poll_block() to wake up when 'latch' is set. */ +/* Causes the next poll_block() to wake up when 'latch' is set. + * + * ('where' is used in debug logging. Commonly one would use latch_wait() to + * automatically provide the caller's source file and line number for + * 'where'.) */ void -(latch_wait)(const struct latch *latch, const char *where) +latch_wait_at(const struct latch *latch, const char *where) { - (poll_fd_wait)(latch->fds[0], POLLIN, where); + poll_fd_wait_at(latch->fds[0], POLLIN, where); } |