diff options
author | Anton Khirnov <anton@khirnov.net> | 2014-08-12 16:24:19 +0000 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2014-08-13 17:24:18 +0000 |
commit | 8ddc32629a6d6be77256694c9e322dde134609f3 (patch) | |
tree | a622ba52184bc16aad030937167c24c03ef43571 /libavutil/mem.h | |
parent | aa51b0492bfced6d650fb5ff419e2b13fde6833d (diff) | |
download | ffmpeg-8ddc32629a6d6be77256694c9e322dde134609f3.tar.gz |
mem: add av_strndup() for duplicating substrings
Diffstat (limited to 'libavutil/mem.h')
-rw-r--r-- | libavutil/mem.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/libavutil/mem.h b/libavutil/mem.h index 4a5e362cec..9f667c270b 100644 --- a/libavutil/mem.h +++ b/libavutil/mem.h @@ -218,6 +218,16 @@ av_alloc_size(1, 2) static inline void *av_mallocz_array(size_t nmemb, size_t si char *av_strdup(const char *s) av_malloc_attrib; /** + * Duplicate a substring of the string s. + * @param s string to be duplicated + * @param len the maximum length of the resulting string (not counting the + * terminating byte). + * @return Pointer to a newly-allocated string containing a + * copy of s or NULL if the string cannot be allocated. + */ +char *av_strndup(const char *s, size_t len) av_malloc_attrib; + +/** * Free a memory block which has been allocated with av_malloc(z)() or * av_realloc() and set the pointer pointing to it to NULL. * @param ptr Pointer to the pointer to the memory block which should |