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
main
Vasile Paraschiv 9 years ago
parent 5d85fdb2c5
commit 71c7eed91c
  1. 5
      util/perf_level.cc

@ -4,9 +4,10 @@
// of patent rights can be found in the PATENTS file in the same directory.
//
#include <assert.h>
#include <sstream>
#include "util/perf_level_imp.h"
#include "port/port.h"
#include "util/perf_level_imp.h"
namespace rocksdb {
@ -17,6 +18,8 @@ __thread PerfLevel perf_level = kEnableCount;
#endif
void SetPerfLevel(PerfLevel level) {
assert(level > kUninitialized);
assert(level < kOutOfBounds);
perf_level = level;
}

Loading…
Cancel
Save