| 79 | } |
| 80 | |
| 81 | const char *strvec_replace(struct strvec *array, size_t idx, const char *replacement) |
| 82 | { |
| 83 | char *to_free; |
| 84 | if (idx >= array->nr) |
| 85 | BUG("index outside of array boundary"); |
| 86 | to_free = (char *) array->v[idx]; |
| 87 | array->v[idx] = xstrdup(replacement); |
| 88 | free(to_free); |
| 89 | return array->v[idx]; |
| 90 | } |
| 91 | |
| 92 | void strvec_remove(struct strvec *array, size_t idx) |
| 93 | { |