https://github.com/neomutt/test-body
⚙️ Refactor `struct Body`
https://github.com/neomutt/test-body
Last synced: 3 months ago
JSON representation
⚙️ Refactor `struct Body`
- Host: GitHub
- URL: https://github.com/neomutt/test-body
- Owner: neomutt
- Created: 2022-01-05T01:49:46.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2022-01-05T12:29:36.000Z (over 4 years ago)
- Last Synced: 2025-12-29T06:30:09.114Z (6 months ago)
- Language: C
- Homepage:
- Size: 14.6 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Refactoring `struct Body`
## Current Scheme
**Key**:
- Green: `Body->next`
- Red: `Body->parts`

The `Body`s are singly-linked.
## Proposed Scheme
This scheme uses `TAILQ` to group the children.
The `Body`s are doubly-linked.

## Sample Code
The sample code mimics an email with lots of nested attachments.
The code recursively dumps the structures.
**To compile**: (with ASAN)
```sh
gcc -Wall -Wextra -Wpedantic -I. -fsanitize=address -o email *.c
```
**To run**:
```sh
./email
```
**Output**:
```
Email: refactoring
Body: apple
Body: aardvark
Body: antelope
Body: banana
Body: baboon
Body: buffalo
Body: bat
Body: cherry
Body: chameleon
```