bug-wget
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-wget] [PATCH] * gnutls.c: wgnutls_read_timeout: removed warning


From: Tim Ruehsen
Subject: Re: [Bug-wget] [PATCH] * gnutls.c: wgnutls_read_timeout: removed warnings, moved fcntl stuff outside loop
Date: Tue, 15 May 2012 09:19:55 +0200
User-agent: KMail/1.13.7 (Linux/3.2.0-2-amd64; KDE/4.7.4; x86_64; ; )

Am Monday 14 May 2012 schrieb Giuseppe Scrivano:
> >        flags = fcntl (fd, F_GETFL, 0);
> >        if (flags < 0)
> > 
> > -        return flags;
> > +        return -1;
> 
> I think that if the caller doesn't really care about the result but just
> check if it is an error (i.e. negative value), then the "return flags"
> form could result in a smaller output.

Well, this part of the code is not a hotspot, so IMHO readability counts first 
here.
Hand-optimizations like you suggest are questionable and did at least confuse 
me. I had to look up fcntl man pages to assure that -1 is the only negative 
value that is ever returned. Before that I even checked the calls to 
wgnutls_read_timeout() to see what is being done with the returned value.
A simple 'return -1' just helps the programmer to maintain the code by saving 
his precious time !

> Cheers,
> Giuseppe

Regards, Tim



reply via email to

[Prev in Thread] Current Thread [Next in Thread]