diff options
Diffstat (limited to 'common')
-rw-r--r-- | common/common.c | 11 | ||||
-rw-r--r-- | common/common.h | 2 |
2 files changed, 13 insertions, 0 deletions
diff --git a/common/common.c b/common/common.c index 9ed63e1783..12e8e141ec 100644 --- a/common/common.c +++ b/common/common.c @@ -302,3 +302,14 @@ char *mp_tprintf_buf(char *buf, size_t buf_size, const char *format, ...) va_end(ap); return buf; } + +char **mp_dup_str_array(void *tctx, char **s) +{ + char **r = NULL; + int num_r = 0; + for (int n = 0; s && s[n]; n++) + MP_TARRAY_APPEND(tctx, r, num_r, talloc_strdup(tctx, s[n])); + if (r) + MP_TARRAY_APPEND(tctx, r, num_r, NULL); + return r; +} diff --git a/common/common.h b/common/common.h index 8dd02026f6..224a6e023a 100644 --- a/common/common.h +++ b/common/common.h @@ -112,4 +112,6 @@ char *mp_tag_str_buf(char *buf, size_t buf_size, uint32_t tag); char *mp_tprintf_buf(char *buf, size_t buf_size, const char *format, ...) PRINTF_ATTRIBUTE(3, 4); +char **mp_dup_str_array(void *tctx, char **s); + #endif /* MPLAYER_MPCOMMON_H */ |