Skip to content

Commit

Permalink
Assert boundary checks for SetPerfLevel()
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Vasile Paraschiv committed Jun 1, 2016
1 parent 5d85fdb commit 71c7eed
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion util/perf_level.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand All @@ -17,6 +18,8 @@ __thread PerfLevel perf_level = kEnableCount;
#endif

void SetPerfLevel(PerfLevel level) {
assert(level > kUninitialized);
assert(level < kOutOfBounds);
perf_level = level;
}

Expand Down

0 comments on commit 71c7eed

Please sign in to comment.