clang-format everything
Change-Id: I37d07b604fe89b9a893503514ef9dc51347a23c6
Reviewed-on: https://gn-review.googlesource.com/1625
Commit-Queue: Scott Graham <scottmg@chromium.org>
Reviewed-by: Brett Wilson <brettw@chromium.org>
diff --git a/base/posix/eintr_wrapper.h b/base/posix/eintr_wrapper.h
index c3565da..5c24e03 100644
--- a/base/posix/eintr_wrapper.h
+++ b/base/posix/eintr_wrapper.h
@@ -25,38 +25,41 @@
#if defined(NDEBUG)
-#define HANDLE_EINTR(x) ({ \
- decltype(x) eintr_wrapper_result; \
- do { \
- eintr_wrapper_result = (x); \
- } while (eintr_wrapper_result == -1 && errno == EINTR); \
- eintr_wrapper_result; \
-})
+#define HANDLE_EINTR(x) \
+ ({ \
+ decltype(x) eintr_wrapper_result; \
+ do { \
+ eintr_wrapper_result = (x); \
+ } while (eintr_wrapper_result == -1 && errno == EINTR); \
+ eintr_wrapper_result; \
+ })
#else
-#define HANDLE_EINTR(x) ({ \
- int eintr_wrapper_counter = 0; \
- decltype(x) eintr_wrapper_result; \
- do { \
- eintr_wrapper_result = (x); \
- } while (eintr_wrapper_result == -1 && errno == EINTR && \
- eintr_wrapper_counter++ < 100); \
- eintr_wrapper_result; \
-})
+#define HANDLE_EINTR(x) \
+ ({ \
+ int eintr_wrapper_counter = 0; \
+ decltype(x) eintr_wrapper_result; \
+ do { \
+ eintr_wrapper_result = (x); \
+ } while (eintr_wrapper_result == -1 && errno == EINTR && \
+ eintr_wrapper_counter++ < 100); \
+ eintr_wrapper_result; \
+ })
#endif // NDEBUG
-#define IGNORE_EINTR(x) ({ \
- decltype(x) eintr_wrapper_result; \
- do { \
- eintr_wrapper_result = (x); \
- if (eintr_wrapper_result == -1 && errno == EINTR) { \
- eintr_wrapper_result = 0; \
- } \
- } while (0); \
- eintr_wrapper_result; \
-})
+#define IGNORE_EINTR(x) \
+ ({ \
+ decltype(x) eintr_wrapper_result; \
+ do { \
+ eintr_wrapper_result = (x); \
+ if (eintr_wrapper_result == -1 && errno == EINTR) { \
+ eintr_wrapper_result = 0; \
+ } \
+ } while (0); \
+ eintr_wrapper_result; \
+ })
#else // !OS_POSIX || OS_FUCHSIA
diff --git a/base/posix/file_descriptor_shuffle.cc b/base/posix/file_descriptor_shuffle.cc
index d2fd39a..f628bec 100644
--- a/base/posix/file_descriptor_shuffle.cc
+++ b/base/posix/file_descriptor_shuffle.cc
@@ -4,17 +4,17 @@
#include "base/posix/file_descriptor_shuffle.h"
-#include <unistd.h>
#include <stddef.h>
+#include <unistd.h>
#include <ostream>
-#include "base/posix/eintr_wrapper.h"
#include "base/logging.h"
+#include "base/posix/eintr_wrapper.h"
namespace base {
-bool PerformInjectiveMultimapDestructive(
- InjectiveMultimap* m, InjectionDelegate* delegate) {
+bool PerformInjectiveMultimapDestructive(InjectiveMultimap* m,
+ InjectionDelegate* delegate) {
static const size_t kMaxExtraFDs = 16;
int extra_fds[kMaxExtraFDs];
unsigned next_extra_fd = 0;
@@ -29,8 +29,8 @@
// We DCHECK the injectiveness of the mapping.
for (size_t j_index = i_index + 1; j_index < m->size(); ++j_index) {
InjectiveMultimap::value_type* j = &(*m)[j_index];
- DCHECK(i->dest != j->dest) << "Both fd " << i->source
- << " and " << j->source << " map to " << i->dest;
+ DCHECK(i->dest != j->dest) << "Both fd " << i->source << " and "
+ << j->source << " map to " << i->dest;
}
const bool is_identity = i->source == i->dest;
@@ -44,8 +44,9 @@
if (next_extra_fd < kMaxExtraFDs) {
extra_fds[next_extra_fd++] = temp_fd;
} else {
- RAW_LOG(ERROR, "PerformInjectiveMultimapDestructive overflowed "
- "extra_fds. Leaking file descriptors!");
+ RAW_LOG(ERROR,
+ "PerformInjectiveMultimapDestructive overflowed "
+ "extra_fds. Leaking file descriptors!");
}
}
diff --git a/base/posix/file_descriptor_shuffle.h b/base/posix/file_descriptor_shuffle.h
index f2e8877..6843498 100644
--- a/base/posix/file_descriptor_shuffle.h
+++ b/base/posix/file_descriptor_shuffle.h
@@ -55,10 +55,7 @@
// A single arc of the directed graph which describes an injective multimapping.
struct InjectionArc {
InjectionArc(int in_source, int in_dest, bool in_close)
- : source(in_source),
- dest(in_dest),
- close(in_close) {
- }
+ : source(in_source), dest(in_dest), close(in_close) {}
int source;
int dest;
@@ -69,11 +66,10 @@
typedef std::vector<InjectionArc> InjectiveMultimap;
bool PerformInjectiveMultimap(const InjectiveMultimap& map,
- InjectionDelegate* delegate);
+ InjectionDelegate* delegate);
-bool PerformInjectiveMultimapDestructive(
- InjectiveMultimap* map,
- InjectionDelegate* delegate);
+bool PerformInjectiveMultimapDestructive(InjectiveMultimap* map,
+ InjectionDelegate* delegate);
// This function will not call malloc but will mutate |map|
static inline bool ShuffleFileDescriptors(InjectiveMultimap* map) {
diff --git a/base/posix/safe_strerror.cc b/base/posix/safe_strerror.cc
index aa18098..3ae684f 100644
--- a/base/posix/safe_strerror.cc
+++ b/base/posix/safe_strerror.cc
@@ -39,13 +39,13 @@
// glibc has two strerror_r functions: a historical GNU-specific one that
// returns type char *, and a POSIX.1-2001 compliant one available since 2.3.4
// that returns int. This wraps the GNU-specific one.
-static void POSSIBLY_UNUSED wrap_posix_strerror_r(
- char *(*strerror_r_ptr)(int, char *, size_t),
- int err,
- char *buf,
- size_t len) {
+static void POSSIBLY_UNUSED
+wrap_posix_strerror_r(char* (*strerror_r_ptr)(int, char*, size_t),
+ int err,
+ char* buf,
+ size_t len) {
// GNU version.
- char *rc = (*strerror_r_ptr)(err, buf, len);
+ char* rc = (*strerror_r_ptr)(err, buf, len);
if (rc != buf) {
// glibc did not use buf and returned a static string instead. Copy it
// into buf.
@@ -62,11 +62,12 @@
// guarantee that they are handled. This is compiled on all POSIX platforms, but
// it will only be used on Linux if the POSIX strerror_r implementation is
// being used (see below).
-static void POSSIBLY_UNUSED wrap_posix_strerror_r(
- int (*strerror_r_ptr)(int, char *, size_t),
- int err,
- char *buf,
- size_t len) {
+static void POSSIBLY_UNUSED wrap_posix_strerror_r(int (*strerror_r_ptr)(int,
+ char*,
+ size_t),
+ int err,
+ char* buf,
+ size_t len) {
int old_errno = errno;
// Have to cast since otherwise we get an error if this is the GNU version
// (but in such a scenario this function is never called). Sadly we can't use
@@ -98,16 +99,13 @@
strerror_error = result;
}
// snprintf truncates and always null-terminates.
- snprintf(buf,
- len,
- "Error %d while retrieving error %d",
- strerror_error,
+ snprintf(buf, len, "Error %d while retrieving error %d", strerror_error,
err);
}
errno = old_errno;
}
-void safe_strerror_r(int err, char *buf, size_t len) {
+void safe_strerror_r(int err, char* buf, size_t len) {
if (buf == nullptr || len <= 0) {
return;
}
diff --git a/base/posix/safe_strerror.h b/base/posix/safe_strerror.h
index 5a2f888..48e9db9 100644
--- a/base/posix/safe_strerror.h
+++ b/base/posix/safe_strerror.h
@@ -9,7 +9,6 @@
#include <string>
-
namespace base {
// BEFORE using anything from this file, first look at PLOG and friends in
@@ -28,7 +27,7 @@
// result is always null-terminated. The value of errno is never changed.
//
// Use this instead of strerror_r().
-void safe_strerror_r(int err, char *buf, size_t len);
+void safe_strerror_r(int err, char* buf, size_t len);
// Calls safe_strerror_r with a buffer of suitable size and returns the result
// in a C++ string.