diff options
author | Nico Weber <nicolasweber@gmx.de> | 2016-11-06 20:27:46 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-06 20:27:46 (GMT) |
commit | b7bac03427e4f13ec7681aa25d3a1111fab7a4c3 (patch) | |
tree | 1305a4191a313e26f3bcdac162d471e0ab48dfbe | |
parent | 6a2b876d3ab210c0c4e61c6f60d34304e024b54d (diff) | |
parent | 05d60b58ab0f8036ea9078fb5dbf3391e180e522 (diff) | |
download | Ninja-b7bac03427e4f13ec7681aa25d3a1111fab7a4c3.zip Ninja-b7bac03427e4f13ec7681aa25d3a1111fab7a4c3.tar.gz Ninja-b7bac03427e4f13ec7681aa25d3a1111fab7a4c3.tar.bz2 |
Merge pull request #1192 from sgraham/tidy-snprintf
Tidy up rate snprintf'ing helper
-rw-r--r-- | src/build.cc | 4 | ||||
-rw-r--r-- | src/build.h | 12 |
2 files changed, 9 insertions, 7 deletions
diff --git a/src/build.cc b/src/build.cc index b806fb5..64710dd 100644 --- a/src/build.cc +++ b/src/build.cc @@ -220,14 +220,14 @@ string BuildStatus::FormatProgressStatus( // Overall finished edges per second. case 'o': overall_rate_.UpdateRate(finished_edges_); - snprinfRate(overall_rate_.rate(), buf, "%.1f"); + SnprintfRate(overall_rate_.rate(), buf, "%.1f"); out += buf; break; // Current rate, average over the last '-j' jobs. case 'c': current_rate_.UpdateRate(finished_edges_); - snprinfRate(current_rate_.rate(), buf, "%.1f"); + SnprintfRate(current_rate_.rate(), buf, "%.1f"); out += buf; break; diff --git a/src/build.h b/src/build.h index e633c95..66ce607 100644 --- a/src/build.h +++ b/src/build.h @@ -212,9 +212,9 @@ struct BuildStatus { /// See the user manual for more information about the available /// placeholders. /// @param progress_status_format The format of the progress status. - /// @param finished True if the edge being printed just finished + /// @param status The status of the edge. string FormatProgressStatus(const char* progress_status_format, - EdgeStatus kEdgeFinished) const; + EdgeStatus status) const; private: void PrintStatus(Edge* edge, EdgeStatus status); @@ -237,9 +237,11 @@ struct BuildStatus { const char* progress_status_format_; template<size_t S> - void snprinfRate(double rate, char(&buf)[S], const char* format) const { - if (rate == -1) snprintf(buf, S, "?"); - else snprintf(buf, S, format, rate); + void SnprintfRate(double rate, char(&buf)[S], const char* format) const { + if (rate == -1) + snprintf(buf, S, "?"); + else + snprintf(buf, S, format, rate); } struct RateInfo { |