diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-12-21 15:42:04 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-12-22 22:25:15 +0100 |
commit | 911676c64374af3959ef01609047503a42d5bf87 (patch) | |
tree | b49ca669971c8b01518813bae8759631072e59d8 /libavutil/avstring.h | |
parent | 1c63aed232febf4404659bf006237ee4f7f17c9c (diff) | |
download | ffmpeg-911676c64374af3959ef01609047503a42d5bf87.tar.gz |
avutil/avstring: add av_strnlen()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavutil/avstring.h')
-rw-r--r-- | libavutil/avstring.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/libavutil/avstring.h b/libavutil/avstring.h index 882a2b57dc..de2f71d12b 100644 --- a/libavutil/avstring.h +++ b/libavutil/avstring.h @@ -132,6 +132,20 @@ size_t av_strlcat(char *dst, const char *src, size_t size); size_t av_strlcatf(char *dst, size_t size, const char *fmt, ...) av_printf_format(3, 4); /** + * Get the count of continuous non zero chars starting from the beginning. + * + * @param len maximum number of characters to check in the string, that + * is the maximum value which is returned by the function + */ +static inline size_t av_strnlen(const char *s, size_t len) +{ + size_t i; + for (i = 0; i < len && s[i]; i++) + ; + return i; +} + +/** * Print arguments following specified format into a large enough auto * allocated buffer. It is similar to GNU asprintf(). * @param fmt printf-compatible format string, specifying how the |