| 108 | } |
| 109 | |
| 110 | void strvec_split(struct strvec *array, const char *to_split) |
| 111 | { |
| 112 | while (isspace(*to_split)) |
| 113 | to_split++; |
| 114 | for (;;) { |
| 115 | const char *p = to_split; |
| 116 | |
| 117 | if (!*p) |
| 118 | break; |
| 119 | |
| 120 | while (*p && !isspace(*p)) |
| 121 | p++; |
| 122 | strvec_push_nodup(array, xstrndup(to_split, p - to_split)); |
| 123 | |
| 124 | while (isspace(*p)) |
| 125 | p++; |
| 126 | to_split = p; |
| 127 | } |
| 128 | } |
| 129 | |
| 130 | void strvec_clear(struct strvec *array) |
| 131 | { |