Apply clang-format to folly/portability/
authorYedidya Feldblum <yfeldblum@fb.com>
Fri, 2 Jun 2017 22:34:42 +0000 (15:34 -0700)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Fri, 2 Jun 2017 22:40:08 +0000 (15:40 -0700)
Summary:
[Folly] Apply `clang-format` to `folly/portability/`.

With some manual rearrangement in the places where `clang-format` does awkward things, with the result that `clang-format` over `folly/portability/` becomes a no-op.

Reviewed By: igorsugak

Differential Revision: D5170107

fbshipit-source-id: ceadd96740b4877cbae947846f0e738e6aaf5ed1

26 files changed:
folly/portability/Asm.h [changed mode: 0755->0644]
folly/portability/BitsFunctexcept.cpp
folly/portability/BitsFunctexcept.h
folly/portability/Builtins.h [changed mode: 0755->0644]
folly/portability/Constexpr.h [changed mode: 0755->0644]
folly/portability/Event.h
folly/portability/Fcntl.cpp [changed mode: 0755->0644]
folly/portability/Memory.cpp
folly/portability/OpenSSL.cpp
folly/portability/OpenSSL.h
folly/portability/Sockets.cpp [changed mode: 0755->0644]
folly/portability/Stdio.cpp [changed mode: 0755->0644]
folly/portability/Stdlib.cpp
folly/portability/String.h [changed mode: 0755->0644]
folly/portability/SysMman.cpp [changed mode: 0755->0644]
folly/portability/SysMman.h [changed mode: 0755->0644]
folly/portability/SysStat.cpp [changed mode: 0755->0644]
folly/portability/SysStat.h [changed mode: 0755->0644]
folly/portability/SysTime.cpp [changed mode: 0755->0644]
folly/portability/SysUio.cpp [changed mode: 0755->0644]
folly/portability/Time.cpp [changed mode: 0755->0644]
folly/portability/Time.h [changed mode: 0755->0644]
folly/portability/Unistd.cpp [changed mode: 0755->0644]
folly/portability/Unistd.h [changed mode: 0755->0644]
folly/portability/Windows.h [changed mode: 0755->0644]
folly/portability/test/TimeTest.cpp

old mode 100755 (executable)
new mode 100644 (file)
index 94b5044..f334364
@@ -19,7 +19,7 @@
 #include <folly/Portability.h>
 
 #ifdef _MSC_VER
-# include <intrin.h>
+#include <intrin.h>
 #endif
 
 namespace folly {
index 80e4a5438e20ef6e49f023c80a1af9c307d1bdb2..cf7f171e2419482af719acb845645b0998e960c8 100644 (file)
@@ -24,7 +24,7 @@
 
 #else
 
-FOLLY_NAMESPACE_STD_BEGIN
+namespace std {
 
 #if _LIBCPP_VERSION < 4000
 void __throw_length_error(char const* msg) {
@@ -45,7 +45,6 @@ void __throw_bad_alloc() {
   throw std::bad_alloc();
 }
 #endif
-
-FOLLY_NAMESPACE_STD_END
+}
 
 #endif
index 72deb3e85852f14b7caec210bdcf212690b0664b..e0f13de972838fc52348e63ed40f8b040cbf1c42 100644 (file)
 
 #else
 
-FOLLY_NAMESPACE_STD_BEGIN
+namespace std {
 
 #if _LIBCPP_VERSION < 4000
-[[noreturn]] void __throw_length_error(char const* msg); // @nolint
+[[noreturn]] void __throw_length_error(char const* msg);
 [[noreturn]] void __throw_logic_error(char const* msg);
 [[noreturn]] void __throw_out_of_range(char const* msg);
 #endif
@@ -38,7 +38,6 @@ FOLLY_NAMESPACE_STD_BEGIN
 #if _CPPLIB_VER // msvc c++ std lib
 [[noreturn]] void __throw_bad_alloc();
 #endif
-
-FOLLY_NAMESPACE_STD_END
+}
 
 #endif
old mode 100755 (executable)
new mode 100644 (file)
index 932d9c4..817d1ad
@@ -43,7 +43,7 @@ FOLLY_ALWAYS_INLINE void __builtin___clear_cache(char* begin, char* end) {
 
 FOLLY_ALWAYS_INLINE int __builtin_clz(unsigned int x) {
   unsigned long index;
-  return (int)(_BitScanReverse(&index, (unsigned long)x) ? 31 - index : 32);
+  return int(_BitScanReverse(&index, (unsigned long)x) ? 31 - index : 32);
 }
 
 FOLLY_ALWAYS_INLINE int __builtin_clzl(unsigned long x) {
@@ -52,28 +52,30 @@ FOLLY_ALWAYS_INLINE int __builtin_clzl(unsigned long x) {
 
 FOLLY_ALWAYS_INLINE int __builtin_clzll(unsigned long long x) {
   unsigned long index;
-  return (int)(_BitScanReverse64(&index, x) ? 63 - index : 64);
+  return int(_BitScanReverse64(&index, x) ? 63 - index : 64);
 }
 
 FOLLY_ALWAYS_INLINE int __builtin_ctzll(unsigned long long x) {
   unsigned long index;
-  return (int)(_BitScanForward64(&index, x) ? index : 64);
+  return int(_BitScanForward64(&index, x) ? index : 64);
 }
 
 FOLLY_ALWAYS_INLINE int __builtin_ffs(int x) {
   unsigned long index;
-  return (int)(_BitScanForward(&index, (unsigned long)x) ? index + 1 : 0);
+  return int(_BitScanForward(&index, (unsigned long)x) ? index + 1 : 0);
 }
 
-FOLLY_ALWAYS_INLINE int __builtin_ffsl(long x) { return __builtin_ffs((int)x); }
+FOLLY_ALWAYS_INLINE int __builtin_ffsl(long x) {
+  return __builtin_ffs(int(x));
+}
 
 FOLLY_ALWAYS_INLINE int __builtin_ffsll(long long x) {
   unsigned long index;
-  return (int)(_BitScanForward64(&index, (unsigned long long)x) ? index + 1 : 0);
+  return int(_BitScanForward64(&index, (unsigned long long)x) ? index + 1 : 0);
 }
 
 FOLLY_ALWAYS_INLINE int __builtin_popcountll(unsigned long long x) {
-  return (int)__popcnt64(x);
+  return int(__popcnt64(x));
 }
 
 FOLLY_ALWAYS_INLINE void* __builtin_return_address(unsigned int frame) {
old mode 100755 (executable)
new mode 100644 (file)
index 2813194..4d99b62
@@ -87,8 +87,9 @@ template <typename Char>
 constexpr size_t constexpr_strlen_internal(const Char* s, size_t len) {
   return *s == Char(0) ? len : constexpr_strlen_internal(s + 1, len + 1);
 }
-static_assert(constexpr_strlen_internal("123456789", 0) == 9,
-              "Someone appears to have broken constexpr_strlen...");
+static_assert(
+    constexpr_strlen_internal("123456789", 0) == 9,
+    "Someone appears to have broken constexpr_strlen...");
 } // namespace detail
 
 template <typename Char>
index 9adb7786568ff2f44e0e437a253dddcd25203560..1d6fe86ac01b245a8dba3038372b39fcf6064c33 100644 (file)
 
 #ifdef _MSC_VER
 // This needs to be before the libevent include.
-# include <folly/portability/Windows.h>
+#include <folly/portability/Windows.h>
 #endif
 
 #include <event.h>
 
 #ifdef _MSC_VER
-# include <event2/event_compat.h>
-# include <folly/portability/Fcntl.h>
+#include <event2/event_compat.h>
+#include <folly/portability/Fcntl.h>
 #endif
 
 namespace folly {
old mode 100755 (executable)
new mode 100644 (file)
index 60e59fc..30bab8f
@@ -24,7 +24,9 @@
 namespace folly {
 namespace portability {
 namespace fcntl {
-int creat(char const* fn, int pm) { return _creat(fn, pm); }
+int creat(char const* fn, int pm) {
+  return _creat(fn, pm);
+}
 
 int fcntl(int fd, int cmd, ...) {
   va_list args;
index c4a0fff344488cf39f8614c21461a8c413bc3581..ca138c03cfc72911dcf5ea2da80aae63d49120b7 100644 (file)
 
 namespace folly {
 namespace detail {
-#if _POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600 ||                    \
-    (defined(__ANDROID__) && (__ANDROID_API__ > 15)) ||                      \
-    (defined(__APPLE__) && (__MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_6 || \
-                            __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_3_0))
+#if _POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600 || \
+    (defined(__ANDROID__) && (__ANDROID_API__ > 15)) ||   \
+    (defined(__APPLE__) &&                                \
+     (__MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_6 ||    \
+      __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_3_0))
 
 // Use posix_memalign, but mimic the behaviour of memalign
 void* aligned_malloc(size_t size, size_t align) {
index 53b020c73d0069dcbf4816c30d49a932c81e3f8f..fb47df42b8e6dee60cacc1f5cdf2d9b78df7693f 100644 (file)
@@ -174,7 +174,6 @@ void HMAC_CTX_free(HMAC_CTX* ctx) {
 }
 
 #endif
-
 }
 }
 }
index a75b015bb55f9d2e6bcb03c2c6fc9ce77e963c2b..38ebc8e71ca399130590a5b401690ebca46ef152 100644 (file)
 // OPENSSL_VERSION_NUMBER to maintain compatibility. The following variables are
 // intended to be specific to OpenSSL.
 #if !defined(OPENSSL_IS_BORINGSSL)
-# define FOLLY_OPENSSL_IS_100                \
+#define FOLLY_OPENSSL_IS_100                \
   (OPENSSL_VERSION_NUMBER >= 0x10000003L && \
    OPENSSL_VERSION_NUMBER < 0x1000105fL)
-# define FOLLY_OPENSSL_IS_101                \
+#define FOLLY_OPENSSL_IS_101                \
   (OPENSSL_VERSION_NUMBER >= 0x1000105fL && \
    OPENSSL_VERSION_NUMBER < 0x1000200fL)
-# define FOLLY_OPENSSL_IS_102                \
+#define FOLLY_OPENSSL_IS_102                \
   (OPENSSL_VERSION_NUMBER >= 0x1000200fL && \
    OPENSSL_VERSION_NUMBER < 0x10100000L)
-# define FOLLY_OPENSSL_IS_110 (OPENSSL_VERSION_NUMBER >= 0x10100000L)
+#define FOLLY_OPENSSL_IS_110 (OPENSSL_VERSION_NUMBER >= 0x10100000L)
 #endif
 
-#if !OPENSSL_IS_BORINGSSL && !FOLLY_OPENSSL_IS_100 && !FOLLY_OPENSSL_IS_101 \
-    && !FOLLY_OPENSSL_IS_102 && !FOLLY_OPENSSL_IS_110
-# warning Compiling with unsupported OpenSSL version
+#if !OPENSSL_IS_BORINGSSL && !FOLLY_OPENSSL_IS_100 && !FOLLY_OPENSSL_IS_101 && \
+    !FOLLY_OPENSSL_IS_102 && !FOLLY_OPENSSL_IS_110
+#warning Compiling with unsupported OpenSSL version
 #endif
 
 // BoringSSL and OpenSSL 0.9.8f later with TLS extension support SNI.
-#if OPENSSL_IS_BORINGSSL ||          \
+#if OPENSSL_IS_BORINGSSL || \
     (OPENSSL_VERSION_NUMBER >= 0x00908070L && !defined(OPENSSL_NO_TLSEXT))
-# define FOLLY_OPENSSL_HAS_SNI 1
+#define FOLLY_OPENSSL_HAS_SNI 1
 #else
-# define FOLLY_OPENSSL_HAS_SNI 0
+#define FOLLY_OPENSSL_HAS_SNI 0
 #endif
 
 // BoringSSL and OpenSSL 1.0.2 later with TLS extension support ALPN.
-#if OPENSSL_IS_BORINGSSL ||          \
+#if OPENSSL_IS_BORINGSSL || \
     (OPENSSL_VERSION_NUMBER >= 0x1000200fL && !defined(OPENSSL_NO_TLSEXT))
-# define FOLLY_OPENSSL_HAS_ALPN 1
+#define FOLLY_OPENSSL_HAS_ALPN 1
 #else
-# define FOLLY_OPENSSL_HAS_ALPN 0
+#define FOLLY_OPENSSL_HAS_ALPN 0
 #endif
 
 // This attempts to "unify" the OpenSSL libcrypto/libssl APIs between
@@ -138,7 +138,6 @@ STACK_OF(X509) * X509_STORE_CTX_get0_untrusted(X509_STORE_CTX* ctx);
 // minor version upgrade will need to remove this
 #define OPENSSL_lh_new OPENSSL_LH_new
 #endif
-
 }
 }
 }
old mode 100755 (executable)
new mode 100644 (file)
index b5f0b7d..db1c2fb
@@ -37,7 +37,9 @@ static struct FSPInit {
     WSADATA dat;
     WSAStartup(MAKEWORD(2, 2), &dat);
   }
-  ~FSPInit() { WSACleanup(); }
+  ~FSPInit() {
+    WSACleanup();
+  }
 } fspInit;
 
 bool is_fh_socket(int fh) {
@@ -271,7 +273,9 @@ ssize_t recvmsg(int s, struct msghdr* message, int /* flags */) {
   msg.dwFlags = 0;
   msg.dwBufferCount = (DWORD)message->msg_iovlen;
   msg.lpBuffers = new WSABUF[message->msg_iovlen];
-  SCOPE_EXIT { delete[] msg.lpBuffers; };
+  SCOPE_EXIT {
+    delete[] msg.lpBuffers;
+  };
   for (size_t i = 0; i < message->msg_iovlen; i++) {
     msg.lpBuffers[i].buf = (CHAR*)message->msg_iov[i].iov_base;
     msg.lpBuffers[i].len = (ULONG)message->msg_iov[i].iov_len;
old mode 100755 (executable)
new mode 100644 (file)
index 4b3c664..41da526
@@ -17,7 +17,9 @@
 #include <folly/portability/Stdio.h>
 
 #ifdef _WIN32
+
 #include <cstdlib>
+
 #include <folly/ScopeGuard.h>
 #include <folly/portability/Unistd.h>
 
@@ -25,7 +27,9 @@ extern "C" {
 int dprintf(int fd, const char* fmt, ...) {
   va_list args;
   va_start(args, fmt);
-  SCOPE_EXIT { va_end(args); };
+  SCOPE_EXIT {
+    va_end(args);
+  };
 
   int ret = vsnprintf(nullptr, 0, fmt, args);
   if (ret <= 0) {
@@ -33,7 +37,9 @@ int dprintf(int fd, const char* fmt, ...) {
   }
   size_t len = size_t(ret);
   char* buf = new char[len + 1];
-  SCOPE_EXIT { delete[] buf; };
+  SCOPE_EXIT {
+    delete[] buf;
+  };
   if (size_t(vsnprintf(buf, len + 1, fmt, args)) == len &&
       write(fd, buf, len) == ssize_t(len)) {
     return ret;
@@ -42,9 +48,13 @@ int dprintf(int fd, const char* fmt, ...) {
   return -1;
 }
 
-int pclose(FILE* f) { return _pclose(f); }
+int pclose(FILE* f) {
+  return _pclose(f);
+}
 
-FILE* popen(const char* name, const char* mode) { return _popen(name, mode); }
+FILE* popen(const char* name, const char* mode) {
+  return _popen(name, mode);
+}
 
 void setbuffer(FILE* f, char* buf, size_t size) {
   setvbuf(f, buf, _IOFBF, size);
@@ -63,4 +73,5 @@ int vasprintf(char** dest, const char* format, va_list ap) {
   return -1;
 }
 }
+
 #endif
index e790a3ea27eaa6906cba5eb993007604a932eb13..55895673da37c0669f0cecdf4d2f99a8d5d6d9d5 100644 (file)
@@ -17,7 +17,9 @@
 #include <folly/portability/Stdlib.h>
 
 #ifdef _WIN32
+
 #include <cstring>
+
 #include <errno.h>
 
 #include <folly/portability/Fcntl.h>
@@ -25,7 +27,9 @@
 #include <folly/portability/Windows.h>
 
 extern "C" {
-char* mktemp(char* tn) { return _mktemp(tn); }
+char* mktemp(char* tn) {
+  return _mktemp(tn);
+}
 
 // While yes, this is for a directory, due to this being windows,
 // a file and directory can't have the same name, resulting in this
@@ -135,9 +139,11 @@ int unsetenv(const char* name) {
   return 0;
 }
 }
+
 #endif
 
 #if !__linux__ && !FOLLY_MOBILE
+
 #include <string>
 #include <vector>
 
@@ -162,4 +168,5 @@ extern "C" int clearenv() {
 
   return 0;
 }
+
 #endif
old mode 100755 (executable)
new mode 100644 (file)
index fc7e85a..02d2418
@@ -16,8 +16,8 @@
 
 #pragma once
 
-#include <string.h>
 #include <stdlib.h>
+#include <string.h>
 
 #include <folly/portability/Config.h>
 
old mode 100755 (executable)
new mode 100644 (file)
index cc24807..af76d8b
@@ -17,7 +17,9 @@
 #include <folly/portability/SysMman.h>
 
 #ifdef _WIN32
+
 #include <cassert>
+
 #include <folly/Portability.h>
 #include <folly/portability/Windows.h>
 
@@ -213,4 +215,5 @@ int munmap(void* addr, size_t length) {
   return 0;
 }
 }
+
 #endif
old mode 100755 (executable)
new mode 100644 (file)
index 7522a41..3f30547
 #pragma once
 
 #ifndef _WIN32
+
 #include <sys/mman.h>
 
 // MAP_ANONYMOUS is named MAP_ANON on OSX/BSD.
 #if defined(__APPLE__) || defined(__FreeBSD__)
-# if !defined(MAP_ANONYMOUS) && defined(MAP_ANON)
-#  define MAP_ANONYMOUS MAP_ANON
-# endif
+#if !defined(MAP_ANONYMOUS) && defined(MAP_ANON)
+#define MAP_ANONYMOUS MAP_ANON
+#endif
 #endif
+
 #else
+
 #include <cstdint>
+
 #include <sys/types.h>
 
 #define MAP_ANONYMOUS 1
@@ -56,4 +60,5 @@ int mprotect(void* addr, size_t size, int prot);
 int munlock(const void* addr, size_t length);
 int munmap(void* addr, size_t length);
 }
+
 #endif
old mode 100755 (executable)
new mode 100644 (file)
index 8efb001..5041594
@@ -20,7 +20,9 @@
 #include <folly/portability/Windows.h>
 
 extern "C" {
-int chmod(char const* fn, int am) { return _chmod(fn, am); }
+int chmod(char const* fn, int am) {
+  return _chmod(fn, am);
+}
 
 int fchmod(int fd, mode_t mode) {
   HANDLE h = (HANDLE)_get_osfhandle(fd);
@@ -49,12 +51,16 @@ int fchmod(int fd, mode_t mode) {
 }
 
 // Just return the result of a normal stat for now
-int lstat(const char* path, struct stat* st) { return stat(path, st); }
+int lstat(const char* path, struct stat* st) {
+  return stat(path, st);
+}
 
 int mkdir(const char* fn, int /* mode */) {
   return _mkdir(fn);
 }
 
-int umask(int md) { return _umask(md); }
+int umask(int md) {
+  return _umask(md);
+}
 }
 #endif
old mode 100755 (executable)
new mode 100644 (file)
index 89acc45..3957108
@@ -35,7 +35,7 @@
 #define S_IRWXU (S_IRUSR | S_IWUSR | S_IXUSR)
 #define S_IRWXG (S_IRGRP | S_IWGRP | S_IXGRP)
 
-#define S_ISDIR(mode) (((mode) & _S_IFDIR) == _S_IFDIR ? 1 : 0)
+#define S_ISDIR(mode) (((mode) & (_S_IFDIR)) == (_S_IFDIR) ? 1 : 0)
 
 // This isn't defined anywhere, so give a sane value.
 #define MAXSYMLINKS 255
old mode 100755 (executable)
new mode 100644 (file)
index b9a9f04..48b343f
@@ -17,7 +17,9 @@
 #include <folly/portability/SysTime.h>
 
 #ifdef _WIN32
+
 #include <cstdint>
+
 #include <Windows.h>
 
 extern "C" {
@@ -58,4 +60,5 @@ void timersub(timeval* a, timeval* b, timeval* res) {
   }
 }
 }
+
 #endif
old mode 100755 (executable)
new mode 100644 (file)
index 54f7202..9a80d27
@@ -73,7 +73,9 @@ static ssize_t doVecOperation(int fd, const iovec* iov, int count) {
   if (lockf(fd, F_LOCK, 0) == -1) {
     return -1;
   }
-  SCOPE_EXIT { lockf(fd, F_ULOCK, 0); };
+  SCOPE_EXIT {
+    lockf(fd, F_ULOCK, 0);
+  };
 
   ssize_t bytesProcessed = 0;
   int curIov = 0;
old mode 100755 (executable)
new mode 100644 (file)
index cb64492..54b3d0a
@@ -325,9 +325,10 @@ int nanosleep(const struct timespec* request, struct timespec* remain) {
   return 0;
 }
 
-char* strptime(const char* __restrict s,
-               const char* __restrict f,
-               struct tm* __restrict tm) {
+char* strptime(
+    const char* __restrict s,
+    const char* __restrict f,
+    struct tm* __restrict tm) {
   // Isn't the C++ standard lib nice? std::get_time is defined such that its
   // format parameters are the exact same as strptime. Of course, we have to
   // create a string stream first, and imbue it with the current C locale, and
old mode 100755 (executable)
new mode 100644 (file)
index 0ed24a2..eb6c794
 // solve that by pretending we have it here in the header and
 // then enable our implementation on the source side so that
 // gets linked in instead.
-#if __MACH__ && ( \
-      MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_12 || \
-      __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_10_0)
+#if __MACH__ &&                                                \
+    (MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_12 || \
+     __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_10_0)
 
-# ifdef FOLLY_HAVE_CLOCK_GETTIME
-# undef FOLLY_HAVE_CLOCK_GETTIME
-# endif
+#ifdef FOLLY_HAVE_CLOCK_GETTIME
+#undef FOLLY_HAVE_CLOCK_GETTIME
+#endif
 
-# define FOLLY_HAVE_CLOCK_GETTIME 1
-# define FOLLY_FORCE_CLOCK_GETTIME_DEFINITION 1
+#define FOLLY_HAVE_CLOCK_GETTIME 1
+#define FOLLY_FORCE_CLOCK_GETTIME_DEFINITION 1
 
 #endif
 
@@ -62,8 +62,9 @@ char* ctime_r(const time_t* t, char* buf);
 tm* gmtime_r(const time_t* t, tm* res);
 tm* localtime_r(const time_t* t, tm* o);
 int nanosleep(const struct timespec* request, struct timespec* remain);
-char* strptime(const char* __restrict buf,
-               const char* __restrict fmt,
-               struct tm* __restrict tm);
+char* strptime(
+    const char* __restrict buf,
+    const char* __restrict fmt,
+    struct tm* __restrict tm);
 }
 #endif
old mode 100755 (executable)
new mode 100644 (file)
index a587ba6..2465291
 #include <folly/portability/Unistd.h>
 
 #ifdef _WIN32
+
 #include <cstdio>
+
 #include <fcntl.h>
+
 #include <folly/portability/Sockets.h>
 #include <folly/portability/Windows.h>
 
@@ -60,9 +63,13 @@ static int wrapPositional(F f, int fd, off_t offset, Args... args) {
 namespace folly {
 namespace portability {
 namespace unistd {
-int access(char const* fn, int am) { return _access(fn, am); }
+int access(char const* fn, int am) {
+  return _access(fn, am);
+}
 
-int chdir(const char* path) { return _chdir(path); }
+int chdir(const char* path) {
+  return _chdir(path);
+}
 
 int close(int fh) {
   if (folly::portability::sockets::is_fh_socket(fh)) {
@@ -111,9 +118,13 @@ int close(int fh) {
   return _close(fh);
 }
 
-int dup(int fh) { return _dup(fh); }
+int dup(int fh) {
+  return _dup(fh);
+}
 
-int dup2(int fhs, int fhd) { return _dup2(fhs, fhd); }
+int dup2(int fhs, int fhd) {
+  return _dup2(fhs, fhd);
+}
 
 int fsync(int fd) {
   HANDLE h = (HANDLE)_get_osfhandle(fd);
@@ -141,29 +152,47 @@ int ftruncate(int fd, off_t len) {
   return 0;
 }
 
-char* getcwd(char* buf, int sz) { return _getcwd(buf, sz); }
+char* getcwd(char* buf, int sz) {
+  return _getcwd(buf, sz);
+}
 
-int getdtablesize() { return _getmaxstdio(); }
+int getdtablesize() {
+  return _getmaxstdio();
+}
 
-int getgid() { return 1; }
+int getgid() {
+  return 1;
+}
 
-pid_t getpid() { return (pid_t)uint64_t(GetCurrentProcessId()); }
+pid_t getpid() {
+  return (pid_t)uint64_t(GetCurrentProcessId());
+}
 
 // No major need to implement this, and getting a non-potentially
 // stale ID on windows is a bit involved.
-pid_t getppid() { return (pid_t)1; }
+pid_t getppid() {
+  return (pid_t)1;
+}
 
-int getuid() { return 1; }
+int getuid() {
+  return 1;
+}
 
-int isatty(int fh) { return _isatty(fh); }
+int isatty(int fh) {
+  return _isatty(fh);
+}
 
-int lockf(int fd, int cmd, off_t len) { return _locking(fd, cmd, len); }
+int lockf(int fd, int cmd, off_t len) {
+  return _locking(fd, cmd, len);
+}
 
 off_t lseek(int fh, off_t off, int orig) {
   return _lseek(fh, off, orig);
 }
 
-int rmdir(const char* path) { return _rmdir(path); }
+int rmdir(const char* path) {
+  return _rmdir(path);
+}
 
 int pipe(int pth[2]) {
   // We need to be able to listen to pipes with
@@ -306,4 +335,5 @@ ssize_t write(int fh, void const* buf, size_t count) {
 }
 }
 }
+
 #endif
old mode 100755 (executable)
new mode 100644 (file)
index 8cbae7a..b4cd106
 #pragma once
 
 #ifndef _WIN32
+
 #include <unistd.h>
+
 #else
+
 #include <cstdint>
+
 #include <sys/locking.h>
+
 #include <folly/portability/SysTypes.h>
 
 // This is different from the normal headers because there are a few cases,
@@ -86,4 +91,5 @@ ssize_t write(int fh, void const* buf, size_t count);
 }
 
 /* using override */ using namespace folly::portability::unistd;
+
 #endif
old mode 100755 (executable)
new mode 100644 (file)
index 7ccfde8..2402bf1
 #ifndef __STDC__
 /* nolint */
 #define __STDC__ 1
-#include <io.h> // nolint
 #include <direct.h> // nolint
+#include <io.h> // nolint
 #undef __STDC__
 #else
-#include <io.h> // nolint
 #include <direct.h> // nolint
+#include <io.h> // nolint
 #endif
 
 #if defined(min) || defined(max)
index 50aa1cba8a6c15b9d91faaba66ebf552bdad8a39..b5541d54c712100475a49c62e60f252d9f709d55 100644 (file)
@@ -16,8 +16,8 @@
 
 #include <folly/portability/Time.h>
 
-#include <folly/test/TestUtils.h>
 #include <folly/portability/GTest.h>
+#include <folly/test/TestUtils.h>
 
 #include <chrono>