[FFmpeg-devel] [PATCH 1/2] avutil/avstring: add av_strnlen()
Giorgio Vazzana
mywing81 at gmail.com
Sun Dec 22 12:14:12 CET 2013
Hi Michael,
2013/12/21 Michael Niedermayer <michaelni at gmx.at>:
> Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> ---
> libavutil/avstring.h | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
> diff --git a/libavutil/avstring.h b/libavutil/avstring.h
> index 882a2b5..fb8236f 100644
> --- a/libavutil/avstring.h
> +++ b/libavutil/avstring.h
> @@ -132,6 +132,17 @@ 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);
>
> /**
> + * Gets the count of continuous non zero chars starting from the begin.
Nit: maybe "...starting from the beginNING."?
> + */
> +static inline size_t av_strnlen(const char *s, size_t len)
> +{
> + int i;
How about 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
> --
> 1.7.9.5
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
More information about the ffmpeg-devel
mailing list