-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switch on
length_read != nullptr
in inline functions rather than in…
… virtual slow functions, so that most of the time the switch happens at compile time. Reduce inlined code size by avoiding `RIEGELI_CHECK` in inlined functions of `Reader`. A check is generally required for checking for size overflow. * In the case of `std::string`, rely on the check done by `std::string::{assign,append}()`, or move it to non-inline non-virtual `Reader::ReadSlow(std::string&)` where a numeric type could overflow before `std::string` could perform a check. * In the case of `Chain` (which needs a check in `ReadAndAppend()`), rely on the check done by `Chain::Append()`, and check in a separate non-inline non-virtual `ReadSlowWithSizeCheck()` before calling virtual `ReadSlow()`. * In the case of `absl::Cord` (which needs a check in `ReadAndAppend()`), do not use the fast path if the `absl::Cord::Append()` could overflow (it does not check the size itself), and move the check to separate non-inline non-virtual `ReadSlowWithSizeCheck()` before calling virtual `ReadSlow()`. Make `Reader::ReadSlow(Cord&)` with `length_read` non-virtual. It was virtual by mistake. PiperOrigin-RevId: 604329798
- Loading branch information
Showing
2 changed files
with
156 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.