# rvnsenkuuu/get_next_line architecture

> Architecture diagram of the GitHub repository rvnsenkuuu/get_next_line, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/rvnsenkuuu/get_next_line
- Repository: https://github.com/rvnsenkuuu/get_next_line

## Overview

This is a small C line-reading library with standard and bonus implementations. A caller supplies a file descriptor; each implementation reads chunks until a newline or EOF, extracts one line, and retains any remainder for the next call. The bonus variant keeps separate stash state per descriptor, while the standard variant has one shared stash. Source excerpts show the runtime flow and utility calls; no README documents additional capabilities.

Main entry points: [`get_next_line.c`](https://github.com/rvnsenkuuu/get_next_line/blob/main/get_next_line.c) (Standard reader), [`get_next_line_bonus.c`](https://github.com/rvnsenkuuu/get_next_line/blob/main/get_next_line_bonus.c) (Bonus reader), [`get_next_line_utils.c`](https://github.com/rvnsenkuuu/get_next_line/blob/main/get_next_line_utils.c) (String and memory helpers), [`get_next_line_utils_bonus.c`](https://github.com/rvnsenkuuu/get_next_line/blob/main/get_next_line_utils_bonus.c) (Bonus helpers)

## Diagram (Mermaid)

```mermaid
flowchart TD

node_caller(("Caller"))
node_fd(("File descriptor"))
node_standard["Standard reader<br/>[get_next_line.c]"]
node_standard_read["Read and stash<br/>[get_next_line.c]"]
node_standard_line["Extract line<br/>[get_next_line.c]"]
node_standard_remainder["Keep remainder<br/>[get_next_line.c]"]
node_standard_state["Single stash<br/>[get_next_line.c]"]
node_bonus["Bonus reader"]
node_bonus_read["Read and stash"]
node_bonus_line["Extract line"]
node_bonus_remainder["Keep remainder"]
node_bonus_state["Per-FD stash"]
node_posix_read["POSIX read"]
node_utils["String and memory helpers"]
node_bonus_utils["Bonus helpers"]
node_line_result["Allocated line"]

node_caller -->|"calls"| node_standard
node_fd -->|"supplies descriptor"| node_standard
node_standard -->|"reads and appends"| node_standard_read
node_standard_read -->|"reads chunks"| node_posix_read
node_standard_read -->|"joins and searches"| node_utils
node_standard_read -->|"updates stash"| node_standard_state
node_standard -->|"extracts"| node_standard_line
node_standard_line -->|"reads stash"| node_standard_state
node_standard_line -->|"then trims"| node_standard_remainder
node_standard_remainder -->|"replaces stash"| node_standard_state
node_standard_line -->|"allocates and measures"| node_utils
node_standard -->|"returns"| node_line_result
node_line_result -->|"delivers line"| node_caller
node_caller -->|"calls"| node_bonus
node_fd -->|"supplies descriptor"| node_bonus
node_bonus -->|"reads and appends"| node_bonus_read
node_bonus_read -->|"reads chunks"| node_posix_read
node_bonus_read -->|"joins and searches"| node_bonus_utils
node_bonus_read -->|"updates stash"| node_bonus_state
node_bonus -->|"extracts"| node_bonus_line
node_bonus_line -->|"reads stash"| node_bonus_state
node_bonus_line -->|"then trims"| node_bonus_remainder
node_bonus_remainder -->|"replaces stash"| node_bonus_state
node_bonus_line -->|"allocates and measures"| node_bonus_utils
node_bonus -->|"returns"| node_line_result
node_line_result -->|"delivers line"| node_caller

click node_standard "https://github.com/rvnsenkuuu/get_next_line/blob/main/get_next_line.c"
click node_standard_read "https://github.com/rvnsenkuuu/get_next_line/blob/main/get_next_line.c"
click node_standard_line "https://github.com/rvnsenkuuu/get_next_line/blob/main/get_next_line.c"
click node_standard_remainder "https://github.com/rvnsenkuuu/get_next_line/blob/main/get_next_line.c"
click node_standard_state "https://github.com/rvnsenkuuu/get_next_line/blob/main/get_next_line.c"
click node_bonus "https://github.com/rvnsenkuuu/get_next_line/blob/main/get_next_line_bonus.c"
click node_bonus_read "https://github.com/rvnsenkuuu/get_next_line/blob/main/get_next_line_bonus.c"
click node_bonus_line "https://github.com/rvnsenkuuu/get_next_line/blob/main/get_next_line_bonus.c"
click node_bonus_remainder "https://github.com/rvnsenkuuu/get_next_line/blob/main/get_next_line_bonus.c"
click node_bonus_state "https://github.com/rvnsenkuuu/get_next_line/blob/main/get_next_line_bonus.c"
click node_utils "https://github.com/rvnsenkuuu/get_next_line/blob/main/get_next_line_utils.c"
click node_bonus_utils "https://github.com/rvnsenkuuu/get_next_line/blob/main/get_next_line_utils_bonus.c"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_caller,node_fd,node_posix_read,node_line_result toneIndigo
class node_standard,node_standard_read,node_standard_line,node_standard_remainder,node_standard_state,node_bonus,node_bonus_read,node_bonus_line,node_bonus_remainder,node_bonus_state,node_utils,node_bonus_utils toneTeal
```

## Components

### Other components

- **Caller**
- **File descriptor**
- [Standard reader](https://github.com/rvnsenkuuu/get_next_line/blob/main/get_next_line.c): `get_next_line.c`
- [Read and stash](https://github.com/rvnsenkuuu/get_next_line/blob/main/get_next_line.c): `get_next_line.c`
- [Extract line](https://github.com/rvnsenkuuu/get_next_line/blob/main/get_next_line.c): `get_next_line.c`
- [Keep remainder](https://github.com/rvnsenkuuu/get_next_line/blob/main/get_next_line.c): `get_next_line.c`
- [Single stash](https://github.com/rvnsenkuuu/get_next_line/blob/main/get_next_line.c): `get_next_line.c`
- [Bonus reader](https://github.com/rvnsenkuuu/get_next_line/blob/main/get_next_line_bonus.c): `get_next_line_bonus.c`
- [Read and stash](https://github.com/rvnsenkuuu/get_next_line/blob/main/get_next_line_bonus.c): `get_next_line_bonus.c`
- [Extract line](https://github.com/rvnsenkuuu/get_next_line/blob/main/get_next_line_bonus.c): `get_next_line_bonus.c`
- [Keep remainder](https://github.com/rvnsenkuuu/get_next_line/blob/main/get_next_line_bonus.c): `get_next_line_bonus.c`
- [Per-FD stash](https://github.com/rvnsenkuuu/get_next_line/blob/main/get_next_line_bonus.c): `get_next_line_bonus.c`
- **POSIX read**
- [String and memory helpers](https://github.com/rvnsenkuuu/get_next_line/blob/main/get_next_line_utils.c): `get_next_line_utils.c`
- [Bonus helpers](https://github.com/rvnsenkuuu/get_next_line/blob/main/get_next_line_utils_bonus.c): `get_next_line_utils_bonus.c`
- **Allocated line**

## Connections

- Caller → Standard reader: calls
- File descriptor → Standard reader: supplies descriptor
- Standard reader → Read and stash: reads and appends
- Read and stash → POSIX read: reads chunks
- Read and stash → String and memory helpers: joins and searches
- Read and stash → Single stash: updates stash
- Standard reader → Extract line: extracts
- Extract line → Single stash: reads stash
- Extract line → Keep remainder: then trims
- Keep remainder → Single stash: replaces stash
- Extract line → String and memory helpers: allocates and measures
- Standard reader → Allocated line: returns
- Allocated line → Caller: delivers line
- Caller → Bonus reader: calls
- File descriptor → Bonus reader: supplies descriptor
- Bonus reader → Read and stash: reads and appends
- Read and stash → POSIX read: reads chunks
- Read and stash → Bonus helpers: joins and searches
- Read and stash → Per-FD stash: updates stash
- Bonus reader → Extract line: extracts
- Extract line → Per-FD stash: reads stash
- Extract line → Keep remainder: then trims
- Keep remainder → Per-FD stash: replaces stash
- Extract line → Bonus helpers: allocates and measures
- Bonus reader → Allocated line: returns
- Allocated line → Caller: delivers line
