# khaled10a/libft architecture

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

- Interactive diagram: https://gitdiagram.com/khaled10a/libft
- Repository: https://github.com/khaled10a/libft

## Overview

Libft is a reusable C utility library: callers use its `ft_` functions for libc-style character, memory, string and allocation operations, plus string utilities, descriptor output and linked-list helpers. The header exposes the API and list type; implementations are separate source files. Only a few internal calls are evidenced by the sampled source, so other functions are grouped by documented capability without implying call relationships. The README documents reuse by other projects; unsampled implementations are not inferred beyond those capabilities.

Main entry points: [`libft.h`](https://github.com/khaled10a/libft/blob/main/libft.h) (Public API), [`ft_lstmap.c`](https://github.com/khaled10a/libft/blob/main/ft_lstmap.c) (List mapping), [`ft_lstclear.c`](https://github.com/khaled10a/libft/blob/main/ft_lstclear.c) (List cleanup), [`ft_split.c`](https://github.com/khaled10a/libft/blob/main/ft_split.c) (String splitting)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_core["Core functions"]
  node_api["Public API<br/>[libft.h]"]
  node_chars["Character checks"]
  node_memory["Memory operations"]
  node_base_strings["Base strings"]
  node_allocation["Allocation and conversion"]
end

subgraph group_strings["String utilities"]
  node_construction["String construction"]
  node_transform["String transforms"]
  node_split["String splitting<br/>[ft_split.c]"]
  node_trim["String trimming<br/>[ft_strtrim.c]"]
end

subgraph group_lists["Linked lists"]
  node_list_create["Node creation<br/>[ft_lstnew.c]"]
  node_list_insert["List insertion"]
  node_list_query["List traversal"]
  node_list_delete["List cleanup<br/>[ft_lstclear.c]"]
  node_list_iter["List iteration<br/>[ft_lstiter.c]"]
  node_list_map["List mapping<br/>[ft_lstmap.c]"]
end

subgraph group_output["Descriptor output"]
  node_fd_output["FD output"]
end

node_caller(("C caller"))

node_caller -->|"uses"| node_api
node_api -->|"exposes"| node_chars
node_api -->|"exposes"| node_memory
node_api -->|"exposes"| node_base_strings
node_api -->|"exposes"| node_allocation
node_api -->|"exposes"| node_construction
node_api -->|"exposes"| node_transform
node_api -->|"exposes"| node_split
node_api -->|"exposes"| node_trim
node_api -->|"exposes"| node_fd_output
node_api -->|"exposes"| node_list_create
node_api -->|"exposes"| node_list_insert
node_api -->|"exposes"| node_list_query
node_api -->|"exposes"| node_list_delete
node_api -->|"exposes"| node_list_iter
node_api -->|"exposes"| node_list_map
node_split -->|"calls substring"| node_construction
node_trim -->|"searches set"| node_base_strings
node_list_delete -->|"deletes nodes"| node_list_delete
node_list_map -->|"creates nodes"| node_list_create
node_list_map -->|"appends nodes"| node_list_insert
node_list_map -->|"cleans on failure"| node_list_delete

click node_api "https://github.com/khaled10a/libft/blob/main/libft.h"
click node_split "https://github.com/khaled10a/libft/blob/main/ft_split.c"
click node_trim "https://github.com/khaled10a/libft/blob/main/ft_strtrim.c"
click node_list_create "https://github.com/khaled10a/libft/blob/main/ft_lstnew.c"
click node_list_delete "https://github.com/khaled10a/libft/blob/main/ft_lstclear.c"
click node_list_iter "https://github.com/khaled10a/libft/blob/main/ft_lstiter.c"
click node_list_map "https://github.com/khaled10a/libft/blob/main/ft_lstmap.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_api,node_chars,node_memory,node_base_strings,node_allocation toneBlue
class node_construction,node_transform,node_split,node_trim toneAmber
class node_list_create,node_list_insert,node_list_query,node_list_delete,node_list_iter,node_list_map toneMint
class node_fd_output toneRose
class node_caller toneIndigo
```

## Components

### Core functions

- [Public API](https://github.com/khaled10a/libft/blob/main/libft.h): `libft.h`
- **Character checks**
- **Memory operations**
- **Base strings**
- **Allocation and conversion**

### String utilities

- **String construction**
- **String transforms**
- [String splitting](https://github.com/khaled10a/libft/blob/main/ft_split.c): `ft_split.c`
- [String trimming](https://github.com/khaled10a/libft/blob/main/ft_strtrim.c): `ft_strtrim.c`

### Linked lists

- [Node creation](https://github.com/khaled10a/libft/blob/main/ft_lstnew.c): `ft_lstnew.c`
- **List insertion**
- **List traversal**
- [List cleanup](https://github.com/khaled10a/libft/blob/main/ft_lstclear.c): `ft_lstclear.c`
- [List iteration](https://github.com/khaled10a/libft/blob/main/ft_lstiter.c): `ft_lstiter.c`
- [List mapping](https://github.com/khaled10a/libft/blob/main/ft_lstmap.c): `ft_lstmap.c`

### Descriptor output

- **FD output**

### Other components

- **C caller**

## Connections

- C caller → Public API: uses
- Public API → Character checks: exposes (evidence: `libft.h`)
- Public API → Memory operations: exposes (evidence: `libft.h`)
- Public API → Base strings: exposes (evidence: `libft.h`)
- Public API → Allocation and conversion: exposes (evidence: `libft.h`)
- Public API → String construction: exposes (evidence: `libft.h`)
- Public API → String transforms: exposes (evidence: `libft.h`)
- Public API → String splitting: exposes (evidence: `libft.h`)
- Public API → String trimming: exposes (evidence: `libft.h`)
- Public API → FD output: exposes (evidence: `libft.h`)
- Public API → Node creation: exposes (evidence: `libft.h`)
- Public API → List insertion: exposes (evidence: `libft.h`)
- Public API → List traversal: exposes (evidence: `libft.h`)
- Public API → List cleanup: exposes (evidence: `libft.h`)
- Public API → List iteration: exposes (evidence: `libft.h`)
- Public API → List mapping: exposes (evidence: `libft.h`)
- String splitting → String construction: calls substring (evidence: `ft_split.c`)
- String trimming → Base strings: searches set (evidence: `ft_strtrim.c`)
- List cleanup → List cleanup: deletes nodes (evidence: `ft_lstclear.c`)
- List mapping → Node creation: creates nodes (evidence: `ft_lstmap.c`)
- List mapping → List insertion: appends nodes (evidence: `ft_lstmap.c`)
- List mapping → List cleanup: cleans on failure (evidence: `ft_lstmap.c`)
