提交 71c7eed9 编写于 作者: V Vasile Paraschiv

Assert boundary checks for SetPerfLevel()

Summary: Add asserts around PerfLevel enum

Test Plan: make all check -j32

Reviewers: sdong

Reviewed By: sdong

Subscribers: andrewkr, dhruba, leveldb

Differential Revision: https://reviews.facebook.net/D59007
上级 5d85fdb2
...@@ -4,9 +4,10 @@ ...@@ -4,9 +4,10 @@
// of patent rights can be found in the PATENTS file in the same directory. // of patent rights can be found in the PATENTS file in the same directory.
// //
#include <assert.h>
#include <sstream> #include <sstream>
#include "util/perf_level_imp.h"
#include "port/port.h" #include "port/port.h"
#include "util/perf_level_imp.h"
namespace rocksdb { namespace rocksdb {
...@@ -17,6 +18,8 @@ __thread PerfLevel perf_level = kEnableCount; ...@@ -17,6 +18,8 @@ __thread PerfLevel perf_level = kEnableCount;
#endif #endif
void SetPerfLevel(PerfLevel level) { void SetPerfLevel(PerfLevel level) {
assert(level > kUninitialized);
assert(level < kOutOfBounds);
perf_level = level; perf_level = level;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册