| 57 | } |
| 58 | |
| 59 | static inline xo_string_node_t * |
| 60 | xo_string_add (xo_string_list_t *listp, const char *str) |
| 61 | { |
| 62 | if (listp == NULL || str == NULL) |
| 63 | return NULL; |
| 64 | |
| 65 | xo_string_list_init(listp); |
| 66 | size_t len = strlen(str); |
| 67 | xo_string_node_t *xsp; |
| 68 | |
| 69 | xsp = xo_realloc(NULL, sizeof(*xsp) + len + 1); |
| 70 | if (xsp) { |
| 71 | memcpy(xsp->xs_data, str, len); |
| 72 | xsp->xs_data[len] = '\0'; |
| 73 | TAILQ_INSERT_TAIL(listp, xsp, xs_link); |
| 74 | } |
| 75 | |
| 76 | return xsp; |
| 77 | } |
| 78 | |
| 79 | #define XO_STRING_LIST_FOREACH(_xsp, _listp) \ |
| 80 | xo_string_list_init(_listp); \ |
no test coverage detected