summaryrefslogtreecommitdiff
path: root/src/pretty_printing.h
diff options
context:
space:
mode:
authorMax Graey <maxgraey@gmail.com>2022-07-29 07:25:43 +0300
committerGitHub <noreply@github.com>2022-07-29 04:25:43 +0000
commit078f7b9bf57426cca2db96edbf213765354fc57a (patch)
tree11aac0d5014ce7230d9c522ce1be6d3807154ae1 /src/pretty_printing.h
parentd02c260619e5d068b6893d4948de0487d0f1f66d (diff)
downloadbinaryen-078f7b9bf57426cca2db96edbf213765354fc57a.tar.gz
binaryen-078f7b9bf57426cca2db96edbf213765354fc57a.tar.bz2
binaryen-078f7b9bf57426cca2db96edbf213765354fc57a.zip
Refactor doIndent (#4847)
Refactor everywhere from: ```c++ for (size_t i = 0; i < indent; i++) { o << ' '; } ``` to: ```c++ o << std::string(indent, ' '); ``` ### Motivation It is much simpler and should produce smaller code.See godbolt: https://godbolt.org/z/KMYMdn7z5
Diffstat (limited to 'src/pretty_printing.h')
-rw-r--r--src/pretty_printing.h5
1 files changed, 1 insertions, 4 deletions
diff --git a/src/pretty_printing.h b/src/pretty_printing.h
index f1dd9db04..f693c4d51 100644
--- a/src/pretty_printing.h
+++ b/src/pretty_printing.h
@@ -26,10 +26,7 @@
#include "support/colors.h"
inline std::ostream& doIndent(std::ostream& o, unsigned indent) {
- for (unsigned i = 0; i < indent; i++) {
- o << " ";
- }
- return o;
+ return o << std::string(indent, ' ');
}
inline std::ostream& prepareMajorColor(std::ostream& o) {