[PATCH:libXt 1/6] Remove unnecessary clause.

Mark Kettenis mark.kettenis at xs4all.nl
Tue Jun 25 14:13:54 PDT 2013


> From: Thomas Klausner <wiz at NetBSD.org>
> Date: Tue, 25 Jun 2013 23:02:45 +0200
> 
> len is unsigned and can't be smaller than zero.

But vsnprintf(3) returns a signed integer, which can be -1.

> ---
>  src/Alloc.c | 3 ---
>  1 file changed, 3 deletions(-)
> 
> diff --git a/src/Alloc.c b/src/Alloc.c
> index c523d81..477dfe0 100644
> --- a/src/Alloc.c
> +++ b/src/Alloc.c
> @@ -140,9 +140,6 @@ Cardinal XtAsprintf(
>      len = vsnprintf(buf, sizeof(buf), format, ap);
>      va_end(ap);
>  
> -    if (len < 0)
> -	_XtAllocError("vsnprintf");
> -
>      *new_string = XtMalloc(len + 1); /* snprintf doesn't count trailing '\0' */
>      if (len < sizeof(buf))
>      {
> -- 
> 1.8.3.1
> 
> _______________________________________________
> xorg-devel at lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: http://lists.x.org/mailman/listinfo/xorg-devel
> 


More information about the xorg-devel mailing list