# a-chem/42-cursus-libft architecture

> Architecture diagram of the GitHub repository a-chem/42-cursus-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/a-chem/42-cursus-libft
- Repository: https://github.com/a-chem/42-cursus-libft

## Overview

Libft is a reusable C utility library that reimplements standard-library-style operations. A client program calls its public functions to transform or inspect values, allocate and manage data, and optionally write results to a file descriptor. The graph groups the documented capabilities and shows only internal calls visible in the supplied excerpts. The README documents the client usage; many individual implementations were not excerpted, so their internal relationships are not inferred.

Main entry points: [`src/ft_lstmap_bonus.c`](https://github.com/a-chem/42-cursus-libft/blob/main/src/ft_lstmap_bonus.c) (Map lists), [`src`](https://github.com/a-chem/42-cursus-libft/tree/main/src) (String operations), [`src/ft_lstadd_back_bonus.c`](https://github.com/a-chem/42-cursus-libft/blob/main/src/ft_lstadd_back_bonus.c) (List operations), [`src/ft_strjoin.c`](https://github.com/a-chem/42-cursus-libft/blob/main/src/ft_strjoin.c) (Build and transform)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_chars["Character utilities"]
  node_char_ops["Classify and case"]
end

subgraph group_memory["Memory utilities"]
  node_memory_ops["Memory operations"]
  node_allocation["Allocation and duplicate<br/>[ft_calloc.c]"]
end

subgraph group_strings["String utilities"]
  node_string_ops["String operations"]
  node_string_build["Build and transform<br/>[ft_strjoin.c]"]
  node_string_split["Split strings<br/>[ft_split.c]"]
end

subgraph group_conversion["Conversions"]
  node_atoi["Parse integer<br/>[ft_atoi.c]"]
  node_itoa["Format integer<br/>[ft_itoa.c]"]
end

subgraph group_output["Descriptor output"]
  node_fd_output["Write to descriptor<br/>[ft_putendl_fd.c]"]
end

subgraph group_lists["Linked lists"]
  node_list_ops["List operations"]
  node_list_map["Map lists<br/>[ft_lstmap_bonus.c]"]
end

node_client(("C client"))

node_client -->|"calls ft_strdup"| node_allocation
node_client -->|"calls ft_putendl_fd"| node_fd_output
node_atoi -->|"checks digits"| node_char_ops
node_string_build -->|"measures strings"| node_string_ops
node_string_split -->|"measures strings"| node_string_ops
node_list_map -->|"creates and appends"| node_list_ops
node_list_map -->|"clears on failure"| node_list_ops

click node_char_ops "https://github.com/a-chem/42-cursus-libft/tree/main/src"
click node_memory_ops "https://github.com/a-chem/42-cursus-libft/tree/main/src"
click node_allocation "https://github.com/a-chem/42-cursus-libft/blob/main/src/ft_calloc.c"
click node_string_ops "https://github.com/a-chem/42-cursus-libft/tree/main/src"
click node_string_build "https://github.com/a-chem/42-cursus-libft/blob/main/src/ft_strjoin.c"
click node_string_split "https://github.com/a-chem/42-cursus-libft/blob/main/src/ft_split.c"
click node_atoi "https://github.com/a-chem/42-cursus-libft/blob/main/src/ft_atoi.c"
click node_itoa "https://github.com/a-chem/42-cursus-libft/blob/main/src/ft_itoa.c"
click node_fd_output "https://github.com/a-chem/42-cursus-libft/blob/main/src/ft_putendl_fd.c"
click node_list_ops "https://github.com/a-chem/42-cursus-libft/blob/main/src/ft_lstadd_back_bonus.c"
click node_list_map "https://github.com/a-chem/42-cursus-libft/blob/main/src/ft_lstmap_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_char_ops,node_client toneBlue
class node_memory_ops,node_allocation toneAmber
class node_string_ops,node_string_build,node_string_split toneMint
class node_atoi,node_itoa toneRose
class node_fd_output toneIndigo
class node_list_ops,node_list_map toneTeal
```

## Components

### Character utilities

- [Classify and case](https://github.com/a-chem/42-cursus-libft/tree/main/src): `src`

### Memory utilities

- [Memory operations](https://github.com/a-chem/42-cursus-libft/tree/main/src): `src`
- [Allocation and duplicate](https://github.com/a-chem/42-cursus-libft/blob/main/src/ft_calloc.c): `src/ft_calloc.c`

### String utilities

- [String operations](https://github.com/a-chem/42-cursus-libft/tree/main/src): `src`
- [Build and transform](https://github.com/a-chem/42-cursus-libft/blob/main/src/ft_strjoin.c): `src/ft_strjoin.c`
- [Split strings](https://github.com/a-chem/42-cursus-libft/blob/main/src/ft_split.c): `src/ft_split.c`

### Conversions

- [Parse integer](https://github.com/a-chem/42-cursus-libft/blob/main/src/ft_atoi.c): `src/ft_atoi.c`
- [Format integer](https://github.com/a-chem/42-cursus-libft/blob/main/src/ft_itoa.c): `src/ft_itoa.c`

### Descriptor output

- [Write to descriptor](https://github.com/a-chem/42-cursus-libft/blob/main/src/ft_putendl_fd.c): `src/ft_putendl_fd.c`

### Linked lists

- [List operations](https://github.com/a-chem/42-cursus-libft/blob/main/src/ft_lstadd_back_bonus.c): `src/ft_lstadd_back_bonus.c`
- [Map lists](https://github.com/a-chem/42-cursus-libft/blob/main/src/ft_lstmap_bonus.c): `src/ft_lstmap_bonus.c`

### Other components

- **C client**

## Connections

- C client → Allocation and duplicate: calls ft_strdup (evidence: `README.md`)
- C client → Write to descriptor: calls ft_putendl_fd (evidence: `README.md`)
- Parse integer → Classify and case: checks digits (evidence: `src/ft_atoi.c`)
- Build and transform → String operations: measures strings (evidence: `src/ft_strjoin.c`)
- Split strings → String operations: measures strings (evidence: `src/ft_split.c`)
- Map lists → List operations: creates and appends (evidence: `src/ft_lstmap_bonus.c`)
- Map lists → List operations: clears on failure (evidence: `src/ft_lstmap_bonus.c`)
