Skip to content

Commit

Permalink
docs: update README
Browse files Browse the repository at this point in the history
Signed-off-by: Homing So <[email protected]>
  • Loading branch information
hominsu committed May 23, 2024
1 parent 0de3a78 commit 89f1b4f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,7 @@ int main(const int argc, char *argv[]) {

// 1. Parse a Bencode string into DOM.
bencode::Document doc;
auto err = doc.Parse(kSample[0]);
if (err != bencode::error::OK) {
if (const auto err = doc.Parse(kSample[0]); err != bencode::error::OK) {
puts(bencode::ParseErrorStr(err));
return EXIT_FAILURE;
}
Expand Down Expand Up @@ -198,7 +197,7 @@ public:
bool Double(const neujson::internal::Double d) {
(void)d;
return true;
};
}
bool String(std::string_view str) { return handler_.String(str); }
bool Key(std::string_view str) { return handler_.Key(str); }
bool StartArray() { return handler_.StartList(); }
Expand Down
5 changes: 2 additions & 3 deletions README_zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,7 @@ int main(const int argc, char *argv[]) {

// 1. Parse a Bencode string into DOM.
bencode::Document doc;
auto err = doc.Parse(kSample[0]);
if (err != bencode::error::OK) {
if (const auto err = doc.Parse(kSample[0]); err != bencode::error::OK) {
puts(bencode::ParseErrorStr(err));
return EXIT_FAILURE;
}
Expand Down Expand Up @@ -198,7 +197,7 @@ public:
bool Double(const neujson::internal::Double d) {
(void)d;
return true;
};
}
bool String(std::string_view str) { return handler_.String(str); }
bool Key(std::string_view str) { return handler_.Key(str); }
bool StartArray() { return handler_.StartList(); }
Expand Down

0 comments on commit 89f1b4f

Please sign in to comment.