[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Bug-wget] [PATCH] * gnutls.c: wgnutls_read_timeout: removed warning
Re: [Bug-wget] [PATCH] * gnutls.c: wgnutls_read_timeout: removed warnings, moved fcntl stuff outside loop
Tue, 15 May 2012 09:19:55 +0200
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
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 !