Skip to content

Commit

Permalink
string_view -> string ref
Browse files Browse the repository at this point in the history
  • Loading branch information
dhconnelly committed Nov 28, 2024
1 parent c2c125d commit 486bb9a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
4 changes: 1 addition & 3 deletions src/json/parser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -242,16 +242,14 @@ ValuePtr Parser::Value() {
}
}

/* static */
ValuePtr Parse(FILE* f, int size) {
auto parser = Parser(f, size);
auto value = parser.Value();
if (parser.pos() != size) throw ParsingError("unexpected trailing data");
return value;
}

/* static */
ValuePtr Parse(const std::string_view s) {
ValuePtr Parse(const std::string& s) {
std::unique_ptr<FILE, decltype(&fclose)> f(
fmemopen((void*)s.data(), s.size(), "r"), fclose);
if (f.get() == nullptr) throw SystemError(errno);
Expand Down
2 changes: 1 addition & 1 deletion src/json/parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class Parser {
};

ValuePtr Parse(FILE* f, int size);
ValuePtr Parse(const std::string_view s);
ValuePtr Parse(const std::string& s);

} // namespace json
} // namespace gabby
Expand Down

0 comments on commit 486bb9a

Please sign in to comment.