diff options
Diffstat (limited to 'strvec.h')
| -rw-r--r-- | strvec.h | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -46,6 +46,9 @@ void strvec_init(struct strvec *); /* Push a copy of a string onto the end of the array. */ const char *strvec_push(struct strvec *, const char *); +/* Push an allocated string onto the end of the array, taking ownership. */ +void strvec_push_nodup(struct strvec *array, char *value); + /** * Format a string and push it onto the end of the array. This is a * convenience wrapper combining `strbuf_addf` and `strvec_push`. @@ -65,6 +68,19 @@ void strvec_pushl(struct strvec *, ...); void strvec_pushv(struct strvec *, const char **); /** + * Replace the value at the given index with a new value. The index must be + * valid. Returns a pointer to the inserted value. + */ +const char *strvec_replace(struct strvec *array, size_t idx, const char *replacement); + +/* + * Remove the value at the given index. The remainder of the array will be + * moved to fill the resulting gap. The provided index must point into the + * array. + */ +void strvec_remove(struct strvec *array, size_t idx); + +/** * Remove the final element from the array. If there are no * elements in the array, do nothing. */ |
