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

Thomas Klausner wiz at NetBSD.org
Tue Jun 25 14:19:17 PDT 2013


On Tue, Jun 25, 2013 at 11:13:54PM +0200, Mark Kettenis wrote:
> > 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.

But you can't put that in an unsigned variable and expect this comparison to fire...
feel free to propose a different patch.
 Thomas

> > ---
> >  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
> > 
> _______________________________________________
> 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