Add .clang-format and apply it

This commit is contained in:
2021-12-02 07:18:16 +00:00
parent e58dede1b6
commit cd5e2538df
103 changed files with 2714 additions and 2132 deletions

View File

@@ -6,7 +6,8 @@
#include <string>
#include <variant>
std::string escape(std::string const &s) {
std::string escape(std::string const& s)
{
std::string escaped;
escaped += '"';
for (auto c : s) {
@@ -19,16 +20,16 @@ std::string escape(std::string const &s) {
return escaped;
}
int main(int argc, char **argv) {
int main(int argc, char** argv)
{
unsigned len = 0;
// Parse the input
for (std::string line; std::getline(std::cin, line);) {
std::string escaped = escape(line);
len += escaped.length() - line.length();
std::cout << line << ": " << line.length() << " memory bytes, "
<< escaped.length() << " escaped bytes, difference: "
<< escaped.length() - line.length() << "\n";
std::cout << line << ": " << line.length() << " memory bytes, " << escaped.length()
<< " escaped bytes, difference: " << escaped.length() - line.length() << "\n";
}
std::cout << len << "\n";