Skip to content

Commit

Permalink
Google-style cleanups (#416)
Browse files Browse the repository at this point in the history
  • Loading branch information
dominichamon committed Jul 13, 2017
1 parent ee3cfca commit e8fc2a2
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
10 changes: 5 additions & 5 deletions include/benchmark/benchmark.h
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ Benchmark* RegisterBenchmarkInternal(Benchmark*);
int InitializeStreams();
BENCHMARK_UNUSED static int stream_init_anchor = InitializeStreams();

} // end namespace internal
} // namespace internal


#if !defined(__GNUC__) || defined(__pnacl__) || defined(EMSCRIPTN)
Expand Down Expand Up @@ -556,7 +556,7 @@ class State {
const int threads;
const size_t max_iterations;

// TODO make me private
// TODO(EricWF) make me private
State(size_t max_iters, const std::vector<int>& ranges, int thread_i,
int n_threads, internal::ThreadTimer* timer,
internal::ThreadManager* manager);
Expand Down Expand Up @@ -671,7 +671,7 @@ class Benchmark {
// Specify if each repetition of the benchmark should be reported separately
// or if only the final statistics should be reported. If the benchmark
// is not repeated then the single result is always reported.
Benchmark* ReportAggregatesOnly(bool v = true);
Benchmark* ReportAggregatesOnly(bool value = true);

// If a particular benchmark is I/O bound, runs multiple threads internally or
// if for some reason CPU timings are not representative, call this method. If
Expand Down Expand Up @@ -867,7 +867,7 @@ class Fixture : public internal::Benchmark {
virtual void BenchmarkCase(State&) = 0;
};

} // end namespace benchmark
} // namespace internal

// ------------------------------------------------------
// Macro to register benchmarks
Expand Down Expand Up @@ -1204,6 +1204,6 @@ inline double GetTimeUnitMultiplier(TimeUnit unit) {
}
}

} // end namespace benchmark
} // namespace benchmark

#endif // BENCHMARK_BENCHMARK_H_
4 changes: 2 additions & 2 deletions src/benchmark.cc
Original file line number Diff line number Diff line change
Expand Up @@ -595,13 +595,13 @@ size_t RunSpecifiedBenchmarks(BenchmarkReporter* console_reporter,
auto& Err = console_reporter->GetErrorStream();

std::string const& fname = FLAGS_benchmark_out;
if (fname == "" && file_reporter) {
if (fname.empty() && file_reporter) {
Err << "A custom file reporter was provided but "
"--benchmark_out=<file> was not specified."
<< std::endl;
std::exit(1);
}
if (fname != "") {
if (!fname.empty()) {
output_file.open(fname);
if (!output_file.is_open()) {
Err << "invalid file name: '" << fname << std::endl;
Expand Down
6 changes: 3 additions & 3 deletions src/commandlineflags.cc
Original file line number Diff line number Diff line change
Expand Up @@ -209,9 +209,9 @@ bool IsFlag(const char* str, const char* flag) {
return (ParseFlagValue(str, flag, true) != nullptr);
}

bool IsTruthyFlagValue(const std::string& str) {
if (str.empty()) return true;
char ch = str[0];
bool IsTruthyFlagValue(const std::string& value) {
if (value.empty()) return true;
char ch = value[0];
return isalnum(ch) &&
!(ch == '0' || ch == 'f' || ch == 'F' || ch == 'n' || ch == 'N');
}
Expand Down
6 changes: 3 additions & 3 deletions src/reporter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ BenchmarkReporter::BenchmarkReporter()

BenchmarkReporter::~BenchmarkReporter() {}

void BenchmarkReporter::PrintBasicContext(std::ostream *out_ptr,
void BenchmarkReporter::PrintBasicContext(std::ostream *out,
Context const &context) {
CHECK(out_ptr) << "cannot be null";
auto &Out = *out_ptr;
CHECK(out) << "cannot be null";
auto &Out = *out;

Out << "Run on (" << context.num_cpus << " X " << context.mhz_per_cpu
<< " MHz CPU " << ((context.num_cpus > 1) ? "s" : "") << ")\n";
Expand Down

0 comments on commit e8fc2a2

Please sign in to comment.