| 72 | } |
| 73 | |
| 74 | static bool set_string(struct strset *set, |
| 75 | struct strset *n, const char *member) |
| 76 | { |
| 77 | /* Substitute magic empty node if this is the empty string */ |
| 78 | if (unlikely(!member[0])) { |
| 79 | n->u.n = malloc(sizeof(*n->u.n)); |
| 80 | if (unlikely(!n->u.n)) { |
| 81 | errno = ENOMEM; |
| 82 | return false; |
| 83 | } |
| 84 | n->u.n->nul_byte = '\0'; |
| 85 | n->u.n->byte_num = (size_t)-1; |
| 86 | /* Attach the string to child[0] */ |
| 87 | n = &n->u.n->child[0]; |
| 88 | } |
| 89 | n->u.s = member; |
| 90 | return true; |
| 91 | } |
| 92 | |
| 93 | bool strset_add(struct strset *set, const char *member) |
| 94 | { |