Key:
- Green:
Body->next
- Red:
Body->parts
The Body
s are singly-linked.
This scheme uses TAILQ
to group the children.
The Body
s are doubly-linked.
The sample code mimics an email with lots of nested attachments. The code recursively dumps the structures.
To compile: (with ASAN)
gcc -Wall -Wextra -Wpedantic -I. -fsanitize=address -o email *.c
To run:
./email
Output:
Email: refactoring
Body: apple
Body: aardvark
Body: antelope
Body: banana
Body: baboon
Body: buffalo
Body: bat
Body: cherry
Body: chameleon