How 0xmedl/get_next_line works
This is a small C library that returns one line per call from a file descriptor, retaining unread bytes between calls. The standard and bonus implementations follow the same workflow: validate the descriptor, fill a persistent stash in fixed-size reads, determine and allocate a line, then remove consumed bytes. The bonus variant keeps separate stash state per descriptor. The source excerpts show the runtime calls; headers are included as public interface components, not runtime stages.
Main entry points: get_next_line.c Line reader · get_next_line_bonus.c Per-FD reader · get_next_line_utils.c Stash utilities · get_next_line_utils_bonus.c Per-FD utilities
Components 8
Standard variant
- Line reader
get_next_line.c - Public interface
get_next_line.h - Stash utilities
get_next_line_utils.c
Bonus variant
- Per-FD reader
get_next_line_bonus.c - Bonus interface
get_next_line_bonus.h - Per-FD utilities
get_next_line_utils_bonus.c
Other components
- Library caller
- File descriptor
Connections 8
- Library caller → Line reader: calls
README.md - Library caller → Per-FD reader: calls
README.md - Line reader → File descriptor: reads
get_next_line.c - Per-FD reader → File descriptor: reads
get_next_line_bonus.c - Line reader → Stash utilities: uses helpers
get_next_line.c - Per-FD reader → Per-FD utilities: uses helpers
get_next_line_bonus.c - Line reader → Library caller: returns line
get_next_line.c - Per-FD reader → Library caller: returns line
get_next_line_bonus.c