Summary:
- Replace instances of '#ifdef FOLLY_*' guards with '#if FOLLY_*'. This
allows the configuration system to disable the guard by defining the
value to 0 using the -D compiler flag.
Test Plan:
- fbconfig -r folly && fbmake runtests
- ./configure && make check on Ubuntu/FC/Mac
Reviewed By: delong.j@fb.com
FB internal diff:
D999129
return wrapvFull(readv, fd, iov, count);
}
-#ifdef FOLLY_HAVE_PREADV
+#if FOLLY_HAVE_PREADV
ssize_t preadvFull(int fd, iovec* iov, int count, off_t offset) {
return wrapvFull(preadv, fd, iov, count, offset);
}
return wrapvFull(writev, fd, iov, count);
}
-#ifdef FOLLY_HAVE_PWRITEV
+#if FOLLY_HAVE_PWRITEV
ssize_t pwritevFull(int fd, iovec* iov, int count, off_t offset) {
return wrapvFull(pwritev, fd, iov, count, offset);
}
ssize_t readFull(int fd, void* buf, size_t n);
ssize_t preadFull(int fd, void* buf, size_t n, off_t offset);
ssize_t readvFull(int fd, iovec* iov, int count);
-#ifdef FOLLY_HAVE_PREADV
+#if FOLLY_HAVE_PREADV
ssize_t preadvFull(int fd, iovec* iov, int count, off_t offset);
#endif
ssize_t writeFull(int fd, const void* buf, size_t n);
ssize_t pwriteFull(int fd, const void* buf, size_t n, off_t offset);
ssize_t writevFull(int fd, iovec* iov, int count);
-#ifdef FOLLY_HAVE_PWRITEV
+#if FOLLY_HAVE_PWRITEV
ssize_t pwritevFull(int fd, iovec* iov, int count, off_t offset);
#endif
// for malloc_usable_size
// NOTE: FreeBSD 9 doesn't have malloc.h. It's defitions
// are found in stdlib.h.
-#ifdef FOLLY_HAVE_MALLOC_H
+#if FOLLY_HAVE_MALLOC_H
#include <malloc.h>
#else
#include <stdlib.h>
#include "folly-config.h"
#endif
-#ifdef FOLLY_HAVE_FEATURES_H
+#if FOLLY_HAVE_FEATURES_H
#include <features.h>
#endif
-#ifdef FOLLY_HAVE_SCHED_H
+#if FOLLY_HAVE_SCHED_H
#include <sched.h>
#ifndef FOLLY_HAVE_PTHREAD_YIELD
#define pthread_yield sched_yield
// We're going to write. Reserve space for ourselves.
off_t pos = filePos_.fetch_add(totalLength);
-#ifdef FOLLY_HAVE_PWRITEV
+#if FOLLY_HAVE_PWRITEV
auto iov = buf->getIov();
ssize_t bytes = pwritevFull(file_.fd(), iov.data(), iov.size(), pos);
#else
# define FB_PACKED
#endif
-#ifdef FOLLY_HAVE_MALLOC_SIZE
+#if FOLLY_HAVE_MALLOC_SIZE
extern "C" std::size_t malloc_size(const void*);
-# ifndef FOLLY_HAVE_MALLOC_USABLE_SIZE
+# if !FOLLY_HAVE_MALLOC_USABLE_SIZE
# define malloc_usable_size malloc_size
# endif
# ifndef malloc_usable_size
}
}
-#ifdef FOLLY_HAVE_PREADV
+#if FOLLY_HAVE_PREADV
TEST_F(FileUtilTest, preadv) {
for (auto& p : readers_) {
IovecBuffers buf({12, 19, 31});