[libcxx-commits] [libcxx] [libc++] Refactor basic_filebuf::overflow() (PR #144793)
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Jun 24 10:58:26 PDT 2025
================
@@ -835,35 +835,50 @@ typename basic_filebuf<_CharT, _Traits>::int_type basic_filebuf<_CharT, _Traits>
}
if (this->pptr() != this->pbase()) {
if (__always_noconv_) {
- size_t __nmemb = static_cast<size_t>(this->pptr() - this->pbase());
- if (std::fwrite(this->pbase(), sizeof(char_type), __nmemb, __file_) != __nmemb)
+ size_t __n = static_cast<size_t>(this->pptr() - this->pbase());
----------------
ldionne wrote:
Yes, I guess if you use `vector` terminology, then `epptr() - pbase()` would be the capacity, and `pptr() - pbase()` would be the size. But here `__n` also corresponds to the number of characters we want to commit, which is why I kinda like `__n`.
I am fine with renaming this post-commit if we find something better.
https://github.com/llvm/llvm-project/pull/144793
More information about the libcxx-commits
mailing list