| 1 | /* @title: Singly linked list */ |
|---|---|
| 2 | #define sll_add(q, thing) \ |
| 3 | if (!q->head) { \ |
| 4 | q->head = thing; \ |
| 5 | q->tail = thing; \ |
| 6 | } else { \ |
| 7 | thing->next = NULL; \ |
| 8 | q->tail->next = thing; \ |
| 9 | q->tail = thing; \ |
| 10 | } |
| 11 |
| 1 | /* @title: Singly linked list */ |
|---|---|
| 2 | #define sll_add(q, thing) \ |
| 3 | if (!q->head) { \ |
| 4 | q->head = thing; \ |
| 5 | q->tail = thing; \ |
| 6 | } else { \ |
| 7 | thing->next = NULL; \ |
| 8 | q->tail->next = thing; \ |
| 9 | q->tail = thing; \ |
| 10 | } |
| 11 |