[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
================
@@ -16,27 +16,37 @@
#include "hdr/errno_macros.h"
#include "hdr/stdio_macros.h"
+#include "hdr/types/off_t.h"
#include "hdr/types/size_t.h"
#include "src/__support/CPP/functional.h"
+#include "src/__support/CPP/limits.h"
#include "src/__support/CPP/span.h"
#include "src/__support/File/file.h"
#include "src/__support/error_or.h"
#include "src/__support/macros/attributes.h"
#include "src/__support/macros/config.h"
+#include "src/__support/pwd/dynamic_buffer.h"
namespace LIBC_NAMESPACE_DECL {
namespace pwd {
+// Struct to hold the result of a line read operation.
struct ReadLineResult {
size_t bytes_read;
+ size_t raw_bytes_consumed;
bool truncated;
- // True only when no data was read because the file stream reached EOF.
+ // True only when zero bytes were read because the stream was already at EOF.
+ // A final line without a trailing newline returns bytes_read > 0 and
+ // eof == false; the following call returns bytes_read == 0 and eof == true.
----------------
vonosmas wrote:
What if the final line is *just* a newline character? (eof would be set to false, but I don't think it's clear from description).
https://github.com/llvm/llvm-project/pull/223811
More information about the libc-commits
mailing list