diff options
author | Daniel Stenberg <daniel@haxx.se> | 2014-10-23 22:56:35 +0200 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2014-10-24 08:23:19 +0200 |
commit | 0eb3d15ccb419bfda41ee31bdbf73c36facc7388 (patch) | |
tree | 0c4abf7bf4bac279cbcfd708e1cdd1bcdf29bb77 /lib/telnet.c | |
parent | 1752e9c088d9bb7a3156dba9c66f7f64dd87afa9 (diff) | |
download | curl-0eb3d15ccb419bfda41ee31bdbf73c36facc7388.tar.gz |
code cleanup: we prefer 'CURLcode result'
... for the local variable name in functions holding the return
code. Using the same name universally makes code easier to read and
follow.
Also, unify code for checking for CURLcode errors with:
if(result) or if(!result)
instead of
if(result == CURLE_OK), if(CURLE_OK == result) or if(result != CURLE_OK)
Diffstat (limited to 'lib/telnet.c')
-rw-r--r-- | lib/telnet.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/lib/telnet.c b/lib/telnet.c index 1f03a00fc..b0f72ab0a 100644 --- a/lib/telnet.c +++ b/lib/telnet.c @@ -1076,7 +1076,7 @@ CURLcode telrcv(struct connectdata *conn, CLIENTWRITE_BODY, \ (char *)&inbuf[startwrite], \ in-startwrite); \ - if(result != CURLE_OK) \ + if(result) \ return result; \ } \ startwrite = -1 @@ -1230,9 +1230,9 @@ static CURLcode send_telnet_data(struct connectdata *conn, unsigned char outbuf[2]; ssize_t bytes_written, total_written; int out_count; - CURLcode rc = CURLE_OK; + CURLcode result = CURLE_OK; - while(rc == CURLE_OK && nread--) { + while(!result && nread--) { outbuf[0] = *buffer++; out_count = 1; if(outbuf[0] == CURL_IAC) @@ -1247,19 +1247,20 @@ static CURLcode send_telnet_data(struct connectdata *conn, switch (Curl_poll(pfd, 1, -1)) { case -1: /* error, abort writing */ case 0: /* timeout (will never happen) */ - rc = CURLE_SEND_ERROR; + result = CURLE_SEND_ERROR; break; default: /* write! */ bytes_written = 0; - rc = Curl_write(conn, conn->sock[FIRSTSOCKET], outbuf+total_written, - out_count-total_written, &bytes_written); + result = Curl_write(conn, conn->sock[FIRSTSOCKET], + outbuf+total_written, out_count-total_written, + &bytes_written); total_written += bytes_written; break; } - /* handle partial write */ - } while(rc == CURLE_OK && total_written < out_count); + /* handle partial write */ + } while(!result && total_written < out_count); } - return rc; + return result; } static CURLcode telnet_done(struct connectdata *conn, |