[libc-commits] [libc] [libc] Support dynamically-grown lines in FlatFileDatabase (PR #223811)
Jeff Bailey via libc-commits
libc-commits at lists.llvm.org
Wed Sep 16 12:01:37 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.
----------------
kaladron wrote:
The newline consumes at least one byte, so you're correct the EOF would return false. I'll update the comment.
https://github.com/llvm/llvm-project/pull/223811
More information about the libc-commits
mailing list