curl-library
Re: Patches for a couple of clang warnings
Date: Wed, 10 Jun 2009 23:28:17 +0200 (CEST)
On Sat, 6 Jun 2009, Fabian Keil wrote:
> The attached patches fix a couple of clang warnings.
Thanks a lot. They're all applied now!
> I left a couple of warnings untouched in places were I thought
> keeping them would keep the code consistent. An example from
> lib/sendf.c is:
>
> 131 else {
> 132 /* copy last byte */
> 133 *outPtr = *inPtr;
> 134 }
> 135 outPtr++;
> 136 inPtr++;
> Value stored to 'inPtr' is never read
Nah, I'll remove that line 136 too.
> Other ones depend on ifdefs and fixing them didn't seem worth it.
> For example in lib/version.c (I'm compiling without USE_ARES):
Yes. Those would be kind of awkward to fix in a nice way.
> Finally there were a few cases were I wasn't sure what to do, for example in
> lib/ftp.c
>
> 1829 rc = Curl_resolv(conn, conn->proxy.name, (int)conn->port, &addr);
> 1830 if(rc == CURLRESOLV_PENDING1)
> 1831 /* BLOCKING */
> 1832 rc = Curl_wait_for_resolv(conn, &addr);
> Value stored to 'rc' is never read
>
> One could either check rc, or use "(void)Curl_wait_for_resolv(conn, &addr);"
> to keep the current behaviour without the dead store. That's a decision for
> someone who knows the code, though.
I think we should always check the return code of functions that return them.
And this function can indeed return an error so we should add a check there.
I'll do this.
-- / daniel.haxx.seReceived on 2009-06-10