From 795aebbee77bb74d8792df96dfe1aa79ec9548fc Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Mon, 10 Jul 2017 15:02:38 -0700 Subject: Give up on uncrustify; switch to clang-format. --- src/platform/posix/posix_pipe.c | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) (limited to 'src/platform/posix/posix_pipe.c') diff --git a/src/platform/posix/posix_pipe.c b/src/platform/posix/posix_pipe.c index c86022ef..78415d26 100644 --- a/src/platform/posix/posix_pipe.c +++ b/src/platform/posix/posix_pipe.c @@ -21,14 +21,14 @@ // Linux eventfd. This is lighter weight than pipes, and has better semantics // to boot. This is far better than say epoll(). -#include #include +#include #include #ifdef EFD_CLOEXEC -#define NNI_EVENTFD_FLAGS EFD_CLOEXEC +#define NNI_EVENTFD_FLAGS EFD_CLOEXEC #else -#define NNI_EVENTFD_FLAGS 0 +#define NNI_EVENTFD_FLAGS 0 #endif int @@ -46,25 +46,22 @@ nni_plat_pipe_open(int *wfd, int *rfd) return (0); } - void nni_plat_pipe_raise(int wfd) { uint64_t one = 1; - (void) write(wfd, &one, sizeof (one)); + (void) write(wfd, &one, sizeof(one)); } - void nni_plat_pipe_clear(int rfd) { uint64_t val; - (void) read(rfd, &val, sizeof (val)); + (void) read(rfd, &val, sizeof(val)); } - void nni_plat_pipe_close(int wfd, int rfd) { @@ -72,11 +69,10 @@ nni_plat_pipe_close(int wfd, int rfd) (void) close(wfd); } - #else // NNG_USE_EVENTFD -#include #include +#include int nni_plat_pipe_open(int *wfd, int *rfd) @@ -97,7 +93,6 @@ nni_plat_pipe_open(int *wfd, int *rfd) return (0); } - void nni_plat_pipe_raise(int wfd) { @@ -106,23 +101,21 @@ nni_plat_pipe_raise(int wfd) (void) write(wfd, &c, 1); } - void nni_plat_pipe_clear(int rfd) { char buf[32]; - int rv; + int rv; for (;;) { // Completely drain the pipe, but don't wait. This coalesces // events somewhat. - if (read(rfd, buf, sizeof (buf)) <= 0) { + if (read(rfd, buf, sizeof(buf)) <= 0) { return; } } } - void nni_plat_pipe_close(int wfd, int rfd) { @@ -130,7 +123,6 @@ nni_plat_pipe_close(int wfd, int rfd) close(rfd); } - #endif // NNG_USE_EVENTFD #else -- cgit v1.2.3-70-g09d2