# gigores/betterstd architecture

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

- Interactive diagram: https://gitdiagram.com/gigores/betterstd
- Repository: https://github.com/gigores/betterstd

## Overview

BetterSTD is a general-purpose GNU C utility library, not an application with a single end-to-end workflow. A caller selects a library capability, invokes its C API, and receives a value, container, allocation, log output, or error result. The graph preserves the README’s major completed capabilities and the substantial container variants listed in the source index. Some implementation files were not excerpted; uncertain dependency edges are omitted or marked dashed rather than presented as verified calls.

Main entry points: [`src/json.c`](https://github.com/gigores/betterstd/blob/main/src/json.c) (JSON), [`src/string.c`](https://github.com/gigores/betterstd/blob/main/src/string.c) (UTF-8 string), [`src/string_view.c`](https://github.com/gigores/betterstd/blob/main/src/string_view.c) (String view), [`src/error.c`](https://github.com/gigores/betterstd/blob/main/src/error.c) (Error handling)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_memory["Memory"]
  node_allocator["Allocator API<br/>[allocator.c]"]
  node_global["Global allocator<br/>[global.c]"]
  node_arena["Arena allocator<br/>[arena.c]"]
  node_pool["Pool allocator<br/>[pool.c]"]
end

subgraph group_containers["Containers"]
  node_balist["Borrowing array<br/>[balist.c]"]
  node_bllist["Borrowing list<br/>[bllist.c]"]
  node_bhtable["Borrowing hash table<br/>[bhtable.c]"]
  node_oalist["Owning array<br/>[oalist.c]"]
  node_ollist["Owning list<br/>[ollist.c]"]
  node_bitset["Bit set<br/>[bit_set.c]"]
end

subgraph group_textdata["Text and data"]
  node_string["UTF-8 string<br/>[string.c]"]
  node_stringview["String view<br/>[string_view.c]"]
  node_utf8["UTF-8 support<br/>[utf8.c]"]
  node_json["JSON<br/>[json.c]"]
end

subgraph group_utilities["Runtime utilities"]
  node_logger["Logging<br/>[logger.c]"]
  node_error["Error handling<br/>[error.c]"]
  node_smartptr["Auto pointers<br/>[smart_pointers.c]"]
  node_datetime["Date and time<br/>[datetime.c]"]
end

node_caller(("C caller"))

node_caller -->|"configures and logs"| node_logger
node_caller -->|"uses"| node_smartptr
node_caller -.->|"allocates"| node_allocator
node_caller -.->|"uses"| node_balist
node_caller -.->|"uses"| node_bllist
node_caller -.->|"uses"| node_bhtable
node_caller -.->|"uses"| node_oalist
node_caller -.->|"uses"| node_ollist
node_caller -.->|"uses"| node_bitset
node_caller -.->|"uses"| node_string
node_caller -.->|"uses"| node_stringview
node_caller -.->|"uses"| node_json
node_caller -.->|"uses"| node_datetime
node_caller -.->|"handles errors"| node_error
node_pool -.->|"tracks blocks with"| node_bitset
node_string -.->|"references"| node_oalist
node_string -.->|"uses"| node_stringview
node_json -.->|"references"| node_bhtable
node_json -.->|"references"| node_bllist
node_json -.->|"references"| node_stringview
node_json -.->|"references"| node_global
node_string -.->|"references"| node_utf8
node_stringview -.->|"references"| node_utf8
node_error -.->|"references"| node_logger

click node_allocator "https://github.com/gigores/betterstd/blob/main/src/allocator.c"
click node_global "https://github.com/gigores/betterstd/blob/main/src/global.c"
click node_arena "https://github.com/gigores/betterstd/blob/main/src/arena.c"
click node_pool "https://github.com/gigores/betterstd/blob/main/src/pool.c"
click node_balist "https://github.com/gigores/betterstd/blob/main/src/balist.c"
click node_bllist "https://github.com/gigores/betterstd/blob/main/src/bllist.c"
click node_bhtable "https://github.com/gigores/betterstd/blob/main/src/bhtable.c"
click node_oalist "https://github.com/gigores/betterstd/blob/main/src/oalist.c"
click node_ollist "https://github.com/gigores/betterstd/blob/main/src/ollist.c"
click node_bitset "https://github.com/gigores/betterstd/blob/main/src/bit_set.c"
click node_string "https://github.com/gigores/betterstd/blob/main/src/string.c"
click node_stringview "https://github.com/gigores/betterstd/blob/main/src/string_view.c"
click node_utf8 "https://github.com/gigores/betterstd/blob/main/src/utf8.c"
click node_json "https://github.com/gigores/betterstd/blob/main/src/json.c"
click node_logger "https://github.com/gigores/betterstd/blob/main/src/logger.c"
click node_error "https://github.com/gigores/betterstd/blob/main/src/error.c"
click node_smartptr "https://github.com/gigores/betterstd/blob/main/src/smart_pointers.c"
click node_datetime "https://github.com/gigores/betterstd/blob/main/src/datetime.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_allocator,node_global,node_arena,node_pool toneBlue
class node_balist,node_bllist,node_bhtable,node_oalist,node_ollist,node_bitset toneAmber
class node_string,node_stringview,node_utf8,node_json toneMint
class node_logger,node_error,node_smartptr,node_datetime toneRose
class node_caller toneIndigo
```

## Components

### Memory

- [Allocator API](https://github.com/gigores/betterstd/blob/main/src/allocator.c): `src/allocator.c`
- [Global allocator](https://github.com/gigores/betterstd/blob/main/src/global.c): `src/global.c`
- [Arena allocator](https://github.com/gigores/betterstd/blob/main/src/arena.c): `src/arena.c`
- [Pool allocator](https://github.com/gigores/betterstd/blob/main/src/pool.c): `src/pool.c`

### Containers

- [Borrowing array](https://github.com/gigores/betterstd/blob/main/src/balist.c): `src/balist.c`
- [Borrowing list](https://github.com/gigores/betterstd/blob/main/src/bllist.c): `src/bllist.c`
- [Borrowing hash table](https://github.com/gigores/betterstd/blob/main/src/bhtable.c): `src/bhtable.c`
- [Owning array](https://github.com/gigores/betterstd/blob/main/src/oalist.c): `src/oalist.c`
- [Owning list](https://github.com/gigores/betterstd/blob/main/src/ollist.c): `src/ollist.c`
- [Bit set](https://github.com/gigores/betterstd/blob/main/src/bit_set.c): `src/bit_set.c`

### Text and data

- [UTF-8 string](https://github.com/gigores/betterstd/blob/main/src/string.c): `src/string.c`
- [String view](https://github.com/gigores/betterstd/blob/main/src/string_view.c): `src/string_view.c`
- [UTF-8 support](https://github.com/gigores/betterstd/blob/main/src/utf8.c): `src/utf8.c`
- [JSON](https://github.com/gigores/betterstd/blob/main/src/json.c): `src/json.c`

### Runtime utilities

- [Logging](https://github.com/gigores/betterstd/blob/main/src/logger.c): `src/logger.c`
- [Error handling](https://github.com/gigores/betterstd/blob/main/src/error.c): `src/error.c`
- [Auto pointers](https://github.com/gigores/betterstd/blob/main/src/smart_pointers.c): `src/smart_pointers.c`
- [Date and time](https://github.com/gigores/betterstd/blob/main/src/datetime.c): `src/datetime.c`

### Other components

- **C caller**

## Connections

- C caller → Logging: configures and logs
- C caller → Auto pointers: uses
- C caller → Allocator API: allocates
- C caller → Borrowing array: uses
- C caller → Borrowing list: uses
- C caller → Borrowing hash table: uses
- C caller → Owning array: uses
- C caller → Owning list: uses
- C caller → Bit set: uses
- C caller → UTF-8 string: uses
- C caller → String view: uses
- C caller → JSON: uses
- C caller → Date and time: uses
- C caller → Error handling: handles errors
- Pool allocator → Bit set: tracks blocks with
- UTF-8 string → Owning array: references
- UTF-8 string → String view: uses
- JSON → Borrowing hash table: references
- JSON → Borrowing list: references
- JSON → String view: references
- JSON → Global allocator: references
- UTF-8 string → UTF-8 support: references
- String view → UTF-8 support: references
- Error handling → Logging: references
