[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:25 PDT 2026
================
@@ -142,9 +224,10 @@ template <typename EntryType> class FlatFileDatabase {
return {};
}
- // Reads and parses the next record from the database. Returns true if an
- // entry was read, false if EOF was reached, or an Error on failure. Blank
- // lines are skipped.
+ // Reads and parses the next record from the database into a fixed buffer.
+ // Returns true if an entry was read, false if EOF was reached, or an Error on
+ // failure. Blank lines are skipped. A record that does not fit in the buffer
+ // is reported as ERANGE.
LIBC_INLINE ErrorOr<bool> getnext(EntryType *entry, cpp::span<char> buffer) {
----------------
vonosmas wrote:
Hm, I think there are some opportunities to templat-ize the code (here and in other places) based on the type of buffer (static buffer, backed by cpp::span<char>, or dynamic buffer based on realloc-ated memory), but probably that can be a separate refactor once the dust settles.
https://github.com/llvm/llvm-project/pull/223811
More information about the libc-commits
mailing list