提交 5f2c136c 编写于 作者: R Rajat Goel

Minor fixes found while trying to compile it using clang on Mac OS X

上级 88664480
......@@ -15,7 +15,7 @@ struct Options;
struct FileMetaData;
class Env;
class EnvOptions;
struct EnvOptions;
class Iterator;
class TableCache;
class VersionEdit;
......
......@@ -421,18 +421,6 @@ class RandomGenerator {
}
};
static Slice TrimSpace(Slice s) {
unsigned int start = 0;
while (start < s.size() && isspace(s[start])) {
start++;
}
unsigned int limit = s.size();
while (limit > start && isspace(s[limit-1])) {
limit--;
}
return Slice(s.data() + start, limit - start);
}
static void AppendWithSpace(std::string* str, Slice msg) {
if (msg.empty()) return;
if (!str->empty()) {
......
......@@ -83,7 +83,6 @@ class MergeHelper {
const Comparator* user_comparator_;
const MergeOperator* user_merge_operator_;
Logger* logger_;
Iterator* iter_; // in: the internal iterator, positioned at the first merge entry
bool assert_valid_internal_key_; // enforce no internal key corruption?
// the scratch area that holds the result of MergeUntil
......
......@@ -97,7 +97,6 @@ class Repairer {
InternalKeyComparator const icmp_;
InternalFilterPolicy const ipolicy_;
Options const options_;
bool owns_cache_;
TableCache* table_cache_;
VersionEdit* edit_;
......
......@@ -18,8 +18,13 @@
#include <memory>
#include <vector>
#include <stdint.h>
#include <sys/types.h>
#include "rocksdb/status.h"
#ifdef __APPLE__
typedef off_t off64_t;
#endif
namespace leveldb {
class FileLock;
......@@ -28,7 +33,7 @@ class RandomAccessFile;
class SequentialFile;
class Slice;
class WritableFile;
class Options;
struct Options;
using std::unique_ptr;
using std::shared_ptr;
......
......@@ -159,7 +159,6 @@ class LRUCache {
// mutex_ protects the following state.
port::Mutex mutex_;
size_t usage_;
uint64_t last_id_;
// Dummy head of LRU list.
// lru.prev is newest entry, lru.next is oldest entry.
......@@ -169,8 +168,7 @@ class LRUCache {
};
LRUCache::LRUCache()
: usage_(0),
last_id_(0) {
: usage_(0) {
// Make empty circular linked list
lru_.next = &lru_;
lru_.prev = &lru_;
......@@ -333,7 +331,7 @@ class ShardedLRUCache : public Cache {
MutexLock l(&id_mutex_);
return ++(last_id_);
}
virtual uint64_t GetCapacity() {
virtual size_t GetCapacity() {
return capacity_;
}
};
......
......@@ -14,10 +14,15 @@
#include <sys/ioctl.h>
#include <sys/mman.h>
#include <sys/stat.h>
#ifdef __APPLE__
#include <sys/param.h>
#include <sys/mount.h>
#else
#include <sys/statfs.h>
#include <sys/vfs.h>
#endif
#include <sys/time.h>
#include <sys/types.h>
#include <sys/vfs.h>
#include <time.h>
#include <unistd.h>
#if defined(OS_LINUX)
......@@ -126,7 +131,9 @@ class PosixSequentialFile: public SequentialFile {
if (!use_os_buffer_) {
// we need to fadvise away the entire range of pages because
// we do not want readahead pages to be cached.
#ifndef __APPLE__
posix_fadvise(fd_, 0, 0, POSIX_FADV_DONTNEED); // free OS pages
#endif
}
return s;
}
......@@ -166,7 +173,9 @@ class PosixRandomAccessFile: public RandomAccessFile {
if (!use_os_buffer_) {
// we need to fadvise away the entire range of pages because
// we do not want readahead pages to be cached.
#ifndef __APPLE__
posix_fadvise(fd_, 0, 0, POSIX_FADV_DONTNEED); // free OS pages
#endif
}
return s;
}
......@@ -201,6 +210,7 @@ class PosixRandomAccessFile: public RandomAccessFile {
#endif
virtual void Hint(AccessPattern pattern) {
#ifndef __APPLE__
switch(pattern) {
case NORMAL:
posix_fadvise(fd_, 0, 0, POSIX_FADV_NORMAL);
......@@ -221,6 +231,7 @@ class PosixRandomAccessFile: public RandomAccessFile {
assert(false);
break;
}
#endif
}
};
......
......@@ -16,8 +16,7 @@ DBWithTTL::DBWithTTL(const int32_t ttl,
const std::string& dbname,
Status& st,
bool read_only)
: StackableDB(nullptr),
ttl_(ttl) {
: StackableDB(nullptr) {
Options options_to_open = options;
if (options.compaction_filter) {
......
......@@ -111,7 +111,6 @@ class DBWithTTL : public StackableDB {
private:
DB* db_;
int32_t ttl_;
unique_ptr<CompactionFilter> ttl_comp_filter_;
};
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册