On Thu, Oct 15, 2015 at 05:38:55PM -0400, Ganesh Ajjanagadde wrote:
> This adds av_warn_unused_result to functions whose return codes need to
> be checked.
> 
> Signed-off-by: Ganesh Ajjanagadde <gajjanaga...@gmail.com>
> ---
>  libavutil/mem.h | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/libavutil/mem.h b/libavutil/mem.h
> index 2a1e36d..285697c 100644
> --- a/libavutil/mem.h
> +++ b/libavutil/mem.h
> @@ -144,6 +144,7 @@ void *av_realloc_f(void *ptr, size_t nelem, size_t 
> elsize);
>   *          The situation is undefined according to POSIX and may crash with
>   *          some libc implementations.
>   */
> +av_warn_unused_result
>  int av_reallocp(void *ptr, size_t size);
>  
>  /**
> @@ -304,6 +305,7 @@ void av_dynarray_add(void *tab_ptr, int *nb_ptr, void 
> *elem);
>   * @return >=0 on success, negative otherwise.
>   * @see av_dynarray_add(), av_dynarray2_add()
>   */
> +av_warn_unused_result
>  int av_dynarray_add_nofree(void *tab_ptr, int *nb_ptr, void *elem);
>  
>  /**

> @@ -334,6 +336,7 @@ void *av_dynarray2_add(void **tab_ptr, int *nb_ptr, 
> size_t elem_size,
>   * Multiply two size_t values checking for overflow.
>   * @return  0 if success, AVERROR(EINVAL) if overflow.
>   */
> +av_warn_unused_result
>  static inline int av_size_mult(size_t a, size_t b, size_t *r)

one doesnt strictly need to check the return value
one could use this as in
size_t r = MAX_WE_SUPPORT + 1;
av_size_mults(a,b,&r)
if (r > MAX_WE_SUPPORT)
    fail

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Good people do not need laws to tell them to act responsibly, while bad
people will find a way around the laws. -- Plato

Attachment: signature.asc
Description: Digital signature

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Reply via email to