[libc-commits] [libc] [libc] Support dynamically-grown lines in FlatFileDatabase (PR #223811)
Alexey Samsonov via libc-commits
libc-commits at lists.llvm.org
Tue Sep 15 15:50:26 PDT 2026
================
@@ -34,59 +35,63 @@ namespace pwd {
// Parses a colon-separated line in-place into a struct passwd.
template <>
-LIBC_INLINE bool parse_line<struct passwd>(cpp::span<char> line,
- struct passwd *pwd) {
- if (line.empty() || !pwd)
- return false;
+LIBC_INLINE ErrorOr<void> parse_line<struct passwd>(cpp::span<char> buffer,
+ size_t line_len,
+ struct passwd *pwd) {
+ if (!pwd || line_len == 0 || line_len >= buffer.size())
----------------
vonosmas wrote:
We really shouldn't have `line_len` as an argument here, since it's only used to do sanity checks and then to take a prefix of the input "buffer" span. The span should just have the correct length instead.
https://github.com/llvm/llvm-project/pull/223811
More information about the libc-commits
mailing list