1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-21 07:38:49 -05:00

Improve code readbility

... by removing the else branch after a return, break or continue.

Closes #1310
This commit is contained in:
Sylvestre Ledru 2017-03-10 14:28:37 +01:00 committed by Daniel Stenberg
parent db87bcfcf2
commit 66de563482
37 changed files with 405 additions and 496 deletions

View File

@ -810,7 +810,6 @@ CURLcode Curl_is_connected(struct connectdata *conn,
return CURLE_OK;
}
else
infof(data, "Connection failed\n");
}
else if(rc & CURL_CSELECT_ERR)

View File

@ -130,7 +130,6 @@ inflate_stream(struct connectdata *conn,
free(decomp);
if(inflateEnd(z) == Z_OK)
return exit_zlib(z, &k->zlib_init, result);
else
return exit_zlib(z, &k->zlib_init, process_zlib_error(conn, z));
}

View File

@ -929,7 +929,6 @@ static char *get_line(char *buf, int len, FILE *input)
}
return b;
}
else
/* read a partial, discard the next piece that ends with newline */
partial = TRUE;
}

View File

@ -469,7 +469,7 @@ Curl_addrinfo *Curl_str2addr(char *address, int port)
/* This is a dotted IP address 123.123.123.123-style */
return Curl_ip2addr(AF_INET, &in, address, port);
#ifdef ENABLE_IPV6
else {
{
struct in6_addr in6;
if(Curl_inet_pton(AF_INET6, address, &in6) > 0)
/* This is a dotted IPv6 address ::1-style */

View File

@ -145,7 +145,6 @@ static int setcharset(unsigned char **p, unsigned char *charset)
else if(c == ']') {
if(something_found)
return SETCHARSET_OK;
else
something_found = TRUE;
state = CURLFNM_SCHS_RIGHTBR;
charset[c] = 1;
@ -244,7 +243,7 @@ static int setcharset(unsigned char **p, unsigned char *charset)
if(c == ']') {
return SETCHARSET_OK;
}
else if(c == '\\') {
if(c == '\\') {
c = *(++(*p));
if(ISPRINT(c)) {
charset[c] = 1;
@ -345,7 +344,6 @@ static int loop(const unsigned char *pattern, const unsigned char *string)
else if(*p == '\0') {
if(*s == '\0')
return CURL_FNMATCH_MATCH;
else
return CURL_FNMATCH_NOMATCH;
}
else if(*p == '\\') {

View File

@ -773,7 +773,6 @@ static CURLcode easy_perform(struct Curl_easy *data, bool events)
curl_multi_cleanup(multi);
if(mcode == CURLM_OUT_OF_MEMORY)
return CURLE_OUT_OF_MEMORY;
else
return CURLE_FAILED_INIT;
}

View File

@ -113,10 +113,8 @@ char *curl_easy_escape(struct Curl_easy *data, const char *string,
testing_ptr = Curl_saferealloc(ns, alloc);
if(!testing_ptr)
return NULL;
else {
ns = testing_ptr;
}
}
result = Curl_convert_to_network(data, &in, 1);
if(result) {

View File

@ -355,7 +355,6 @@ static CURLcode file_upload(struct connectdata *conn)
failf(data, "Can't get the size of %s", file->path);
return CURLE_WRITE_ERROR;
}
else
data->state.resume_from = (curl_off_t)file_stat.st_size;
}
@ -519,7 +518,6 @@ static CURLcode file_do(struct connectdata *conn, bool *done)
failf(data, "Can't get the size of file.");
return CURLE_READ_ERROR;
}
else
data->state.resume_from += (curl_off_t)statbuf.st_size;
}

View File

@ -630,7 +630,6 @@ CURLFORMcode FormAdd(struct curl_httppost **httppost,
return_value = CURL_FORMADD_INCOMPLETE;
break;
}
else {
if(((form->flags & HTTPPOST_FILENAME) ||
(form->flags & HTTPPOST_BUFFER)) &&
!form->contenttype) {
@ -694,7 +693,6 @@ CURLFORMcode FormAdd(struct curl_httppost **httppost,
if(form->contenttype)
prevtype = form->contenttype;
}
}
if(CURL_FORMADD_OK != return_value) {
/* On error, free allocated fields for nodes of the FormInfo linked
list which are not already owned by the httppost linked list
@ -1463,7 +1461,6 @@ static size_t readfromfile(struct Form *form, char *buffer,
if(callback) {
if(form->fread_func == ZERO_NULL)
return 0;
else
nread = form->fread_func(buffer, 1, size, form->data->line);
}
else {

View File

@ -916,7 +916,6 @@ static int ftp_domore_getsock(struct connectdata *conn, curl_socket_t *socks,
return bits;
}
else
return Curl_pp_getsock(&conn->proto.ftpc.pp, socks, numsocks);
}
@ -1209,7 +1208,7 @@ static CURLcode ftp_state_use_port(struct connectdata *conn,
possibly_non_local = FALSE; /* don't try this again */
continue;
}
else if(error != EADDRINUSE && error != EACCES) {
if(error != EADDRINUSE && error != EACCES) {
failf(data, "bind(port=%hu) failed: %s", port,
Curl_strerror(conn, error) );
Curl_closesocket(conn, portsock);
@ -1307,7 +1306,7 @@ static CURLcode ftp_state_use_port(struct connectdata *conn,
}
break;
}
else if(PORT == fcmd) {
if(PORT == fcmd) {
char *source = myhost;
char *dest = tmp;
@ -1674,13 +1673,12 @@ static CURLcode ftp_state_ul_setup(struct connectdata *conn,
}
if(seekerr != CURL_SEEKFUNC_OK) {
curl_off_t passed=0;
if(seekerr != CURL_SEEKFUNC_CANTSEEK) {
failf(data, "Could not seek stream");
return CURLE_FTP_COULDNT_USE_REST;
}
/* seekerr == CURL_SEEKFUNC_CANTSEEK (can't seek to offset) */
else {
curl_off_t passed=0;
do {
size_t readthisamountnow =
(data->state.resume_from - passed > CURL_OFF_T_C(BUFSIZE)) ?
@ -1699,7 +1697,6 @@ static CURLcode ftp_state_ul_setup(struct connectdata *conn,
}
} while(passed < data->state.resume_from);
}
}
/* now, decrease the size of the read */
if(data->state.infilesize>0) {
data->state.infilesize -= data->state.resume_from;
@ -2412,7 +2409,6 @@ static CURLcode ftp_state_stor_resp(struct connectdata *conn,
return CURLE_OK;
}
else
return InitiateTransfer(conn);
}
@ -2948,13 +2944,11 @@ static CURLcode ftp_statemach_act(struct connectdata *conn)
state(conn, FTP_NAMEFMT);
break;
}
else {
/* Nothing special for the target server. */
/* remember target server OS */
Curl_safefree(ftpc->server_os);
ftpc->server_os = os;
}
}
else {
/* Cannot identify server OS. Continue anyway and cross fingers. */
}
@ -3800,13 +3794,11 @@ static CURLcode init_wc_data(struct connectdata *conn)
result = ftp_parse_url_path(conn);
return result;
}
else {
wildcard->pattern = strdup(last_slash);
if(!wildcard->pattern)
return CURLE_OUT_OF_MEMORY;
last_slash[0] = '\0'; /* cut file from path */
}
}
else { /* there is only 'wildcard pattern' or nothing */
if(path[0]) {
wildcard->pattern = strdup(path);
@ -3890,7 +3882,6 @@ static CURLcode wc_statemach(struct connectdata *conn)
if(wildcard->state == CURLWC_CLEAN)
/* only listing! */
break;
else
wildcard->state = result ? CURLWC_ERROR : CURLWC_MATCHING;
break;
@ -3909,7 +3900,7 @@ static CURLcode wc_statemach(struct connectdata *conn)
wildcard->state = CURLWC_CLEAN;
return wc_statemach(conn);
}
else if(wildcard->filelist->size == 0) {
if(wildcard->filelist->size == 0) {
/* no corresponding file */
wildcard->state = CURLWC_CLEAN;
return CURLE_REMOTE_FILE_NOT_FOUND;

View File

@ -433,11 +433,9 @@ size_t Curl_ftp_parselist(char *buffer, size_t size, size_t nmemb,
PL_ERROR(conn, CURLE_FTP_BAD_FILE_LIST);
return bufflen;
}
else {
parser->state.UNIX.main = PL_UNIX_FILETYPE;
finfo->b_used = 0;
}
}
else {
PL_ERROR(conn, CURLE_FTP_BAD_FILE_LIST);
return bufflen;

View File

@ -91,11 +91,9 @@ Curl_hash_init(struct curl_hash *h,
}
return 0; /* fine */
}
else {
h->slots = 0;
return 1; /* failure */
}
}
static struct curl_hash_element *
mk_hash_element(const void *key, size_t key_len, const void *p)
@ -347,11 +345,9 @@ Curl_hash_next_element(struct curl_hash_iterator *iter)
struct curl_hash_element *he = iter->current_element->ptr;
return he;
}
else {
iter->current_element = NULL;
return NULL;
}
}
#if 0 /* useful function for debugging hashes and their contents */
void Curl_hash_print(struct curl_hash *h,

View File

@ -87,7 +87,7 @@ static int hostmatch(char *hostname, char *pattern)
if(Curl_inet_pton(AF_INET, hostname, &ignored) > 0)
return CURL_HOST_NOMATCH;
#ifdef ENABLE_IPV6
else if(Curl_inet_pton(AF_INET6, hostname, &si6.sin6_addr) > 0)
if(Curl_inet_pton(AF_INET6, hostname, &si6.sin6_addr) > 0)
return CURL_HOST_NOMATCH;
#endif

View File

@ -1197,7 +1197,6 @@ CURLcode Curl_add_buffer_send(Curl_send_buffer *in,
This needs FIXing.
*/
return CURLE_SEND_ERROR;
else
Curl_pipeline_leave_write(conn);
}
}
@ -2156,13 +2155,13 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
}
if(seekerr != CURL_SEEKFUNC_OK) {
curl_off_t passed=0;
if(seekerr != CURL_SEEKFUNC_CANTSEEK) {
failf(data, "Could not seek stream");
return CURLE_READ_ERROR;
}
/* when seekerr == CURL_SEEKFUNC_CANTSEEK (can't seek to offset) */
else {
curl_off_t passed=0;
do {
size_t readthisamountnow =
(data->state.resume_from - passed > CURL_OFF_T_C(BUFSIZE)) ?
@ -2182,7 +2181,6 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
}
} while(passed < data->state.resume_from);
}
}
/* now, decrease the size of the read */
if(data->state.infilesize>0) {
@ -2827,7 +2825,6 @@ checkrtspprefix(struct Curl_easy *data,
#endif /* CURL_DOES_CONVERSIONS */
if(checkprefix("RTSP/", s))
return TRUE;
else
return FALSE;
}
#endif /* CURL_DISABLE_RTSP */

View File

@ -293,11 +293,9 @@ CURLcode Curl_proxyCONNECT(struct connectdata *conn,
if(!Curl_conn_data_pending(conn, sockindex))
/* return so we'll be called again polling-style */
return CURLE_OK;
else {
DEBUGF(infof(data,
"Read response immediately from proxy CONNECT\n"));
}
}
/* at this point, the tunnel_connecting phase is over. */
@ -342,7 +340,7 @@ CURLcode Curl_proxyCONNECT(struct connectdata *conn,
}
continue;
}
else if(result) {
if(result) {
keepon = FALSE;
break;
}
@ -617,12 +615,10 @@ CURLcode Curl_proxyCONNECT(struct connectdata *conn,
if(conn->bits.proxy_connect_closed)
/* this is not an error, just part of the connection negotiation */
return CURLE_OK;
else {
failf(data, "Received HTTP code %d from proxy after CONNECT",
data->req.httpcode);
return CURLE_RECV_ERROR;
}
}
conn->tunnel_state[sockindex] = TUNNEL_COMPLETE;

View File

@ -1096,7 +1096,6 @@ char *curl_maprintf(const char *format, ...)
info.buffer[info.len] = 0; /* we terminate this with a zero byte */
return info.buffer;
}
else
return strdup("");
}
@ -1121,7 +1120,6 @@ char *curl_mvaprintf(const char *format, va_list ap_save)
info.buffer[info.len] = 0; /* we terminate this with a zero byte */
return info.buffer;
}
else
return strdup("");
}

View File

@ -959,11 +959,9 @@ CURLMcode curl_multi_fdset(struct Curl_multi *multi,
if(s == CURL_SOCKET_BAD)
/* this socket is unused, break out of loop */
break;
else {
if((int)s > this_max_fd)
this_max_fd = (int)s;
}
}
data = data->next; /* check next handle */
}
@ -2277,7 +2275,6 @@ CURLMcode curl_multi_cleanup(struct Curl_multi *multi)
return CURLM_OK;
}
else
return CURLM_BAD_HANDLE;
}
@ -2313,7 +2310,6 @@ CURLMsg *curl_multi_info_read(struct Curl_multi *multi, int *msgs_in_queue)
return &msg->extmsg;
}
else
return NULL;
}
@ -2575,7 +2571,7 @@ static CURLMcode multi_socket(struct Curl_multi *multi,
/* or should we fall-through and do the timer-based stuff? */
return result;
}
else if(s != CURL_SOCKET_TIMEOUT) {
if(s != CURL_SOCKET_TIMEOUT) {
struct Curl_sh_entry *entry = sh_getentry(&multi->sockhash, s);

View File

@ -58,7 +58,6 @@ int curlx_nonblock(curl_socket_t sockfd, /* operate on this */
flags = sfcntl(sockfd, F_GETFL, 0);
if(nonblock)
return sfcntl(sockfd, F_SETFL, flags | O_NONBLOCK);
else
return sfcntl(sockfd, F_SETFL, flags & (~O_NONBLOCK));
#elif defined(HAVE_IOCTL_FIONBIO)

View File

@ -267,7 +267,7 @@ long Curl_pgrsLimitWaitTime(curl_off_t cursize,
if(actual < minimum)
/* this is a conversion on some systems (64bit time_t => 32bit long) */
return (long)(minimum - actual);
else
return 0;
}
@ -454,7 +454,7 @@ int Curl_pgrsUpdate(struct connectdata *conn)
failf(data, "Callback aborted");
return result;
}
else if(data->set.fprogress) {
if(data->set.fprogress) {
/* The older deprecated callback is set, call that */
result= data->set.fprogress(data->set.progress_client,
(double)data->progress.size_dl,

View File

@ -216,7 +216,7 @@ static CURLcode rtsp_done(struct connectdata *conn,
CSeq_sent, CSeq_recv);
return CURLE_RTSP_CSEQ_ERROR;
}
else if(data->set.rtspreq == RTSPREQ_RECEIVE &&
if(data->set.rtspreq == RTSPREQ_RECEIVE &&
(conn->proto.rtspc.rtp_channel == -1)) {
infof(data, "Got an RTP Receive with a CSeq of %ld\n", CSeq_recv);
/* TODO CPC: Server -> Client logic here */
@ -648,7 +648,6 @@ static CURLcode rtsp_rtp_readwrite(struct Curl_easy *data,
*readmore = TRUE;
break;
}
else {
/* We have the full RTP interleaved packet
* Write out the header including the leading '$' */
DEBUGF(infof(data, "RTP write channel %d rtp_length %d\n",
@ -674,7 +673,6 @@ static CURLcode rtsp_rtp_readwrite(struct Curl_easy *data,
k->keepon &= ~KEEP_RECV;
}
}
}
else {
/* Need more - incomplete header */
*readmore = TRUE;
@ -703,7 +701,6 @@ static CURLcode rtsp_rtp_readwrite(struct Curl_easy *data,
*nread = 0;
return CURLE_OK;
}
else {
/* Fix up k->str to point just after the last RTP packet */
k->str += *nread - rtp_dataleft;
@ -716,7 +713,6 @@ static CURLcode rtsp_rtp_readwrite(struct Curl_easy *data,
DEBUGASSERT(rtp_dataleft <= *nread); /* sanity check */
*nread = rtp_dataleft;
}
/* If we get here, we have finished with the leftover/merge buffer */
Curl_safefree(rtspc->rtp_buf);

View File

@ -565,10 +565,9 @@ CURLcode Curl_client_chop_write(struct connectdata *conn,
failf(data, "Write callback asked for PAUSE when not supported!");
return CURLE_WRITE_ERROR;
}
else
return pausewrite(data, type, ptr, len);
}
else if(wrote != chunklen) {
if(wrote != chunklen) {
failf(data, "Failed writing body (%zu != %zu)", wrote, chunklen);
return CURLE_WRITE_ERROR;
}
@ -652,7 +651,6 @@ CURLcode Curl_read_plain(curl_socket_t sockfd,
#endif
if(return_error)
return CURLE_AGAIN;
else
return CURLE_RECV_ERROR;
}

View File

@ -73,7 +73,7 @@ int Curl_blockread_all(struct connectdata *conn, /* connection data */
result = Curl_read_plain(sockfd, buf, buffersize, &nread);
if(CURLE_AGAIN == result)
continue;
else if(result)
if(result)
break;
if(buffersize == nread) {
@ -416,7 +416,7 @@ CURLcode Curl_SOCKS5(const char *proxy_name,
failf(conn->data, "SOCKS5: no connection here");
return CURLE_COULDNT_CONNECT;
}
else if(0 == result) {
if(0 == result) {
failf(conn->data, "SOCKS5: connection timeout");
return CURLE_OPERATION_TIMEDOUT;
}
@ -457,7 +457,7 @@ CURLcode Curl_SOCKS5(const char *proxy_name,
failf(conn->data, "SOCKS5 nothing to read");
return CURLE_COULDNT_CONNECT;
}
else if(0 == result) {
if(0 == result) {
failf(conn->data, "SOCKS5 read timeout");
return CURLE_OPERATION_TIMEDOUT;
}
@ -553,7 +553,7 @@ CURLcode Curl_SOCKS5(const char *proxy_name,
"SOCKS5 GSSAPI per-message authentication is not supported.");
return CURLE_COULDNT_CONNECT;
}
else if(socksreq[1] == 255) {
if(socksreq[1] == 255) {
#endif
if(!proxy_name || !*proxy_name) {
failf(data,
@ -772,9 +772,7 @@ CURLcode Curl_SOCKS5(const char *proxy_name,
}
return CURLE_COULDNT_CONNECT;
}
else {
infof(data, "SOCKS5 request granted.\n");
}
(void)curlx_nonblock(sock, TRUE);
return CURLE_OK; /* Proxy was successful! */

View File

@ -55,11 +55,9 @@ CURLcode Curl_speedcheck(struct Curl_easy *data,
data->set.low_speed_time);
return CURLE_OPERATION_TIMEDOUT;
}
else {
/* wait complete low_speed_time */
Curl_expire_latest(data, nextcheck);
}
}
else {
/* we keep up the required speed all right */
data->state.keeps_speed = now;

View File

@ -201,11 +201,9 @@ struct Curl_tree *Curl_splaygetbest(struct timeval i,
return x;
}
else {
*removed = NULL; /* no match */
return t; /* It wasn't there */
}
}
/* Deletes the very node we point out from the tree if it's there. Stores a

105
lib/ssh.c
View File

@ -688,13 +688,10 @@ static CURLcode ssh_check_fingerprint(struct connectdata *conn)
sshc->actualcode = CURLE_PEER_FAILED_VERIFICATION;
return sshc->actualcode;
}
else {
infof(data, "MD5 checksum match!\n");
/* as we already matched, we skip the check for known hosts */
return CURLE_OK;
}
}
else
return ssh_knownhost(conn);
}
@ -738,7 +735,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
if(rc == LIBSSH2_ERROR_EAGAIN) {
break;
}
else if(rc) {
if(rc) {
failf(data, "Failure establishing ssh session");
state(conn, SSH_SESSION_FREE);
sshc->actualcode = CURLE_FAILED_INIT;
@ -782,7 +779,6 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
state(conn, SSH_AUTH_DONE);
break;
}
else {
err = libssh2_session_last_errno(sshc->ssh_session);
if(err == LIBSSH2_ERROR_EAGAIN)
rc = LIBSSH2_ERROR_EAGAIN;
@ -792,7 +788,6 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
}
break;
}
}
infof(data, "SSH authentication methods available: %s\n",
sshc->authlist);
@ -942,7 +937,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
if(rc == LIBSSH2_ERROR_EAGAIN) {
break;
}
else if(rc == 0) {
if(rc == 0) {
sshc->authed = TRUE;
infof(data, "Initialized password authentication\n");
state(conn, SSH_AUTH_DONE);
@ -1081,7 +1076,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
if(rc == LIBSSH2_ERROR_EAGAIN) {
break;
}
else if(rc == 0) {
if(rc == 0) {
sshc->authed = TRUE;
infof(data, "Initialized keyboard interactive authentication\n");
}
@ -1120,13 +1115,12 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
*/
sshc->sftp_session = libssh2_sftp_init(sshc->ssh_session);
if(!sshc->sftp_session) {
char *err_msg;
if(libssh2_session_last_errno(sshc->ssh_session) ==
LIBSSH2_ERROR_EAGAIN) {
rc = LIBSSH2_ERROR_EAGAIN;
break;
}
else {
char *err_msg;
(void)libssh2_session_last_error(sshc->ssh_session,
&err_msg, NULL, 0);
@ -1135,7 +1129,6 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
sshc->actualcode = CURLE_FAILED_INIT;
break;
}
}
state(conn, SSH_SFTP_REALPATH);
break;
@ -1151,7 +1144,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
if(rc == LIBSSH2_ERROR_EAGAIN) {
break;
}
else if(rc > 0) {
if(rc > 0) {
/* It seems that this string is not always NULL terminated */
tempHome[rc] = '\0';
sshc->homedir = strdup(tempHome);
@ -1265,7 +1258,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
state(conn, SSH_SFTP_NEXT_QUOTE);
break;
}
else if(cmd) {
if(cmd) {
/*
* the arguments following the command must be separated from the
* command with a space so we can check for it unconditionally
@ -1325,7 +1318,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
state(conn, SSH_SFTP_QUOTE_STAT);
break;
}
else if(strncasecompare(cmd, "ln ", 3) ||
if(strncasecompare(cmd, "ln ", 3) ||
strncasecompare(cmd, "symlink ", 8)) {
/* symbolic linking */
/* sshc->quote_path1 is the source */
@ -1447,7 +1440,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
if(rc == LIBSSH2_ERROR_EAGAIN) {
break;
}
else if(rc != 0 && !sshc->acceptfail) { /* get those attributes */
if(rc != 0 && !sshc->acceptfail) { /* get those attributes */
err = sftp_libssh2_last_error(sshc->sftp_session);
Curl_safefree(sshc->quote_path1);
Curl_safefree(sshc->quote_path2);
@ -1518,7 +1511,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
if(rc == LIBSSH2_ERROR_EAGAIN) {
break;
}
else if(rc != 0 && !sshc->acceptfail) {
if(rc != 0 && !sshc->acceptfail) {
err = sftp_libssh2_last_error(sshc->sftp_session);
Curl_safefree(sshc->quote_path1);
Curl_safefree(sshc->quote_path2);
@ -1541,7 +1534,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
if(rc == LIBSSH2_ERROR_EAGAIN) {
break;
}
else if(rc != 0 && !sshc->acceptfail) {
if(rc != 0 && !sshc->acceptfail) {
err = sftp_libssh2_last_error(sshc->sftp_session);
Curl_safefree(sshc->quote_path1);
Curl_safefree(sshc->quote_path2);
@ -1562,7 +1555,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
if(rc == LIBSSH2_ERROR_EAGAIN) {
break;
}
else if(rc != 0 && !sshc->acceptfail) {
if(rc != 0 && !sshc->acceptfail) {
err = sftp_libssh2_last_error(sshc->sftp_session);
Curl_safefree(sshc->quote_path1);
failf(data, "mkdir command failed: %s", sftp_libssh2_strerror(err));
@ -1586,7 +1579,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
if(rc == LIBSSH2_ERROR_EAGAIN) {
break;
}
else if(rc != 0 && !sshc->acceptfail) {
if(rc != 0 && !sshc->acceptfail) {
err = sftp_libssh2_last_error(sshc->sftp_session);
Curl_safefree(sshc->quote_path1);
Curl_safefree(sshc->quote_path2);
@ -1605,7 +1598,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
if(rc == LIBSSH2_ERROR_EAGAIN) {
break;
}
else if(rc != 0 && !sshc->acceptfail) {
if(rc != 0 && !sshc->acceptfail) {
err = sftp_libssh2_last_error(sshc->sftp_session);
Curl_safefree(sshc->quote_path1);
failf(data, "rmdir command failed: %s", sftp_libssh2_strerror(err));
@ -1623,7 +1616,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
if(rc == LIBSSH2_ERROR_EAGAIN) {
break;
}
else if(rc != 0 && !sshc->acceptfail) {
if(rc != 0 && !sshc->acceptfail) {
err = sftp_libssh2_last_error(sshc->sftp_session);
Curl_safefree(sshc->quote_path1);
failf(data, "rm command failed: %s", sftp_libssh2_strerror(err));
@ -1646,7 +1639,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
if(rc == LIBSSH2_ERROR_EAGAIN) {
break;
}
else if(rc != 0 && !sshc->acceptfail) {
if(rc != 0 && !sshc->acceptfail) {
err = sftp_libssh2_last_error(sshc->sftp_session);
Curl_safefree(sshc->quote_path1);
failf(data, "statvfs command failed: %s", sftp_libssh2_strerror(err));
@ -1709,7 +1702,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
if(rc == LIBSSH2_ERROR_EAGAIN) {
break;
}
else if(rc == 0) {
if(rc == 0) {
data->info.filetime = (long)attrs.mtime;
}
@ -1747,7 +1740,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
if(rc == LIBSSH2_ERROR_EAGAIN) {
break;
}
else if(rc) {
if(rc) {
data->state.resume_from = 0;
}
else {
@ -1782,7 +1775,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
if(LIBSSH2_ERROR_EAGAIN == rc)
break;
else {
if(LIBSSH2_ERROR_SFTP_PROTOCOL == rc)
/* only when there was an SFTP protocol error can we extract
the sftp error! */
@ -1798,7 +1791,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
sftp_libssh2_strerror(err));
break;
}
else if(((err == LIBSSH2_FX_NO_SUCH_FILE) ||
if(((err == LIBSSH2_FX_NO_SUCH_FILE) ||
(err == LIBSSH2_FX_FAILURE) ||
(err == LIBSSH2_FX_NO_SUCH_PATH)) &&
(data->set.ftp_create_missing_dirs &&
@ -1824,7 +1817,6 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
err, rc);
break;
}
}
/* If we have a restart point then we need to seek to the correct
position. */
@ -1836,14 +1828,13 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
}
if(seekerr != CURL_SEEKFUNC_OK) {
curl_off_t passed=0;
if(seekerr != CURL_SEEKFUNC_CANTSEEK) {
failf(data, "Could not seek stream");
return CURLE_FTP_COULDNT_USE_REST;
}
/* seekerr == CURL_SEEKFUNC_CANTSEEK (can't seek to offset) */
else {
curl_off_t passed=0;
do {
size_t readthisamountnow =
(data->state.resume_from - passed > CURL_OFF_T_C(BUFSIZE)) ?
@ -1862,7 +1853,6 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
}
} while(passed < data->state.resume_from);
}
}
/* now, decrease the size of the read */
if(data->state.infilesize > 0) {
@ -1926,9 +1916,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
state(conn, SSH_SFTP_CREATE_DIRS_MKDIR);
break;
}
else {
state(conn, SSH_SFTP_UPLOAD_INIT);
}
break;
case SSH_SFTP_CREATE_DIRS_MKDIR:
@ -1956,10 +1944,8 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
sshc->actualcode = result?result:CURLE_SSH;
break;
}
else {
rc = 0; /* clear rc and continue */
}
}
state(conn, SSH_SFTP_CREATE_DIRS);
break;
@ -1985,7 +1971,6 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
rc = LIBSSH2_ERROR_EAGAIN;
break;
}
else {
err = sftp_libssh2_last_error(sshc->sftp_session);
failf(data, "Could not open directory for reading: %s",
sftp_libssh2_strerror(err));
@ -1994,7 +1979,6 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
sshc->actualcode = result?result:CURLE_SSH;
break;
}
}
sshc->readdir_filename = malloc(PATH_MAX+1);
if(!sshc->readdir_filename) {
state(conn, SSH_SFTP_CLOSE);
@ -2200,7 +2184,6 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
rc = LIBSSH2_ERROR_EAGAIN;
break;
}
else {
err = sftp_libssh2_last_error(sshc->sftp_session);
failf(data, "Could not open remote file for reading: %s",
sftp_libssh2_strerror(err));
@ -2209,7 +2192,6 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
sshc->actualcode = result?result:CURLE_SSH;
break;
}
}
state(conn, SSH_SFTP_DOWNLOAD_STAT);
break;
@ -2223,7 +2205,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
if(rc == LIBSSH2_ERROR_EAGAIN) {
break;
}
else if(rc ||
if(rc ||
!(attrs.flags & LIBSSH2_SFTP_ATTR_SIZE) ||
(attrs.filesize == 0)) {
/*
@ -2321,7 +2303,6 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
state(conn, SSH_STOP);
break;
}
else {
Curl_setup_transfer(conn, FIRSTSOCKET, data->req.size,
FALSE, NULL, -1, NULL);
@ -2332,7 +2313,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
out writableable as the underlying libssh2 recv function will deal
with both accordingly */
conn->cselect_bits = CURL_CSELECT_IN;
}
if(result) {
/* this should never occur; the close state should be entered
at the time the error occurs */
@ -2350,7 +2331,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
if(rc == LIBSSH2_ERROR_EAGAIN) {
break;
}
else if(rc < 0) {
if(rc < 0) {
infof(data, "Failed to close libssh2 file\n");
}
sshc->sftp_handle = NULL;
@ -2384,7 +2365,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
if(rc == LIBSSH2_ERROR_EAGAIN) {
break;
}
else if(rc < 0) {
if(rc < 0) {
infof(data, "Failed to close libssh2 file\n");
}
sshc->sftp_handle = NULL;
@ -2394,7 +2375,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
if(rc == LIBSSH2_ERROR_EAGAIN) {
break;
}
else if(rc < 0) {
if(rc < 0) {
infof(data, "Failed to stop libssh2 sftp subsystem\n");
}
sshc->sftp_session = NULL;
@ -2439,14 +2420,14 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
SCP_SEND(sshc->ssh_session, sftp_scp->path, data->set.new_file_perms,
data->state.infilesize);
if(!sshc->ssh_channel) {
int ssh_err;
char *err_msg;
if(libssh2_session_last_errno(sshc->ssh_session) ==
LIBSSH2_ERROR_EAGAIN) {
rc = LIBSSH2_ERROR_EAGAIN;
break;
}
else {
int ssh_err;
char *err_msg;
ssh_err = (int)(libssh2_session_last_error(sshc->ssh_session,
&err_msg, NULL, 0));
@ -2455,7 +2436,6 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
sshc->actualcode = libssh2_session_error_to_CURLE(ssh_err);
break;
}
}
/* upload data */
Curl_setup_transfer(conn, -1, data->req.size, FALSE, NULL,
@ -2509,14 +2489,15 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
#endif
if(!sshc->ssh_channel) {
int ssh_err;
char *err_msg;
if(libssh2_session_last_errno(sshc->ssh_session) ==
LIBSSH2_ERROR_EAGAIN) {
rc = LIBSSH2_ERROR_EAGAIN;
break;
}
else {
int ssh_err;
char *err_msg;
ssh_err = (int)(libssh2_session_last_error(sshc->ssh_session,
&err_msg, NULL, 0));
@ -2525,7 +2506,6 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
sshc->actualcode = libssh2_session_error_to_CURLE(ssh_err);
break;
}
}
/* download data */
bytecount = (curl_off_t)sb.st_size;
@ -2562,7 +2542,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
if(rc == LIBSSH2_ERROR_EAGAIN) {
break;
}
else if(rc) {
if(rc) {
infof(data, "Failed to send libssh2 channel EOF\n");
}
}
@ -2575,7 +2555,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
if(rc == LIBSSH2_ERROR_EAGAIN) {
break;
}
else if(rc) {
if(rc) {
infof(data, "Failed to get channel EOF: %d\n", rc);
}
}
@ -2588,7 +2568,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
if(rc == LIBSSH2_ERROR_EAGAIN) {
break;
}
else if(rc) {
if(rc) {
infof(data, "Channel failed to close: %d\n", rc);
}
}
@ -2601,7 +2581,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
if(rc == LIBSSH2_ERROR_EAGAIN) {
break;
}
else if(rc < 0) {
if(rc < 0) {
infof(data, "Failed to free libssh2 scp subsystem\n");
}
sshc->ssh_channel = NULL;
@ -2623,7 +2603,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
if(rc == LIBSSH2_ERROR_EAGAIN) {
break;
}
else if(rc < 0) {
if(rc < 0) {
infof(data, "Failed to free libssh2 scp subsystem\n");
}
sshc->ssh_channel = NULL;
@ -2634,7 +2614,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
if(rc == LIBSSH2_ERROR_EAGAIN) {
break;
}
else if(rc < 0) {
if(rc < 0) {
infof(data, "Failed to disconnect libssh2 session\n");
}
}
@ -2659,7 +2639,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
if(rc == LIBSSH2_ERROR_EAGAIN) {
break;
}
else if(rc < 0) {
if(rc < 0) {
infof(data, "Failed to disconnect from libssh2 agent\n");
}
libssh2_agent_free(sshc->ssh_agent);
@ -2677,7 +2657,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
if(rc == LIBSSH2_ERROR_EAGAIN) {
break;
}
else if(rc < 0) {
if(rc < 0) {
infof(data, "Failed to free libssh2 session\n");
}
sshc->ssh_session = NULL;
@ -2843,6 +2823,7 @@ static CURLcode ssh_block_statemach(struct connectdata *conn,
while((sshc->state != SSH_STOP) && !result) {
bool block;
long left;
struct timeval now = Curl_tvnow();
result = ssh_statemach_act(conn, &block);
if(result)
@ -2850,12 +2831,10 @@ static CURLcode ssh_block_statemach(struct connectdata *conn,
if(Curl_pgrsUpdate(conn))
return CURLE_ABORTED_BY_CALLBACK;
else {
struct timeval now = Curl_tvnow();
result = Curl_speedcheck(data, now);
if(result)
break;
}
left = Curl_timeleft(data, NULL, duringconnect);
if(left < 0) {

View File

@ -125,7 +125,7 @@ int Curl_safe_strcasecompare(const char *first, const char *second)
if(first && second)
/* both pointers point to something then compare them */
return Curl_strcasecompare(first, second);
else
/* if both pointers are NULL then treat them as equal */
return (NULL == first && NULL == second);
}

View File

@ -899,12 +899,10 @@ static CURLcode check_telnet_options(struct connectdata *conn)
result = CURLE_UNKNOWN_TELNET_OPTION;
break;
}
else {
failf(data, "Syntax error in telnet option: %s", head->data);
result = CURLE_TELNET_OPTION_SYNTAX;
break;
}
}
if(result) {
curl_slist_free_all(tn->telnet_vars);
@ -1594,7 +1592,7 @@ static CURLcode telnet_do(struct connectdata *conn, bool *done)
if(result == CURLE_AGAIN)
break;
/* returned not-zero, this an error */
else if(result) {
if(result) {
keepon = FALSE;
break;
}

View File

@ -359,7 +359,7 @@ static CURLcode tftp_parse_option_ack(tftp_state_data_t *state,
failf(data, "invalid blocksize value in OACK packet");
return CURLE_TFTP_ILLEGAL;
}
else if(blksize > TFTP_BLKSIZE_MAX) {
if(blksize > TFTP_BLKSIZE_MAX) {
failf(data, "%s (%d)", "blksize is larger than max supported",
TFTP_BLKSIZE_MAX);
return CURLE_TFTP_ILLEGAL;
@ -1189,7 +1189,7 @@ static long tftp_state_timeout(struct connectdata *conn, tftp_event_t *event)
state->state = TFTP_STATE_FIN;
return 0;
}
else if(current > state->rx_time+state->retry_time) {
if(current > state->rx_time+state->retry_time) {
if(event)
*event = TFTP_EVENT_TIMEOUT;
time(&state->rx_time); /* update even though we received nothing */
@ -1223,7 +1223,7 @@ static CURLcode tftp_multi_statemach(struct connectdata *conn, bool *done)
failf(data, "TFTP response timeout");
return CURLE_OPERATION_TIMEDOUT;
}
else if(event != TFTP_EVENT_NONE) {
if(event != TFTP_EVENT_NONE) {
result = tftp_state_machine(state, event);
if(result)
return result;

View File

@ -139,7 +139,6 @@ double curlx_tvdiff_secs(struct timeval newer, struct timeval older)
if(newer.tv_sec != older.tv_sec)
return (double)(newer.tv_sec-older.tv_sec)+
(double)(newer.tv_usec-older.tv_usec)/1000000.0;
else
return (double)(newer.tv_usec-older.tv_usec)/1000000.0;
}

View File

@ -117,7 +117,8 @@ CURLcode Curl_fillreadbuffer(struct connectdata *conn, int bytes, int *nreadp)
*nreadp = 0;
return CURLE_ABORTED_BY_CALLBACK;
}
else if(nread == CURL_READFUNC_PAUSE) {
if(nread == CURL_READFUNC_PAUSE) {
struct SingleRequest *k = &data->req;
if(conn->handler->flags & PROTOPT_NONETWORK) {
/* protocols that work without network cannot be paused. This is
@ -126,8 +127,7 @@ CURLcode Curl_fillreadbuffer(struct connectdata *conn, int bytes, int *nreadp)
failf(data, "Read callback asked for PAUSE when not supported!");
return CURLE_READ_ERROR;
}
else {
struct SingleRequest *k = &data->req;
/* CURL_READFUNC_PAUSE pauses read callbacks that feed socket writes */
k->keepon |= KEEP_SEND_PAUSE; /* mark socket send as paused */
if(data->req.upload_chunky) {
@ -135,7 +135,7 @@ CURLcode Curl_fillreadbuffer(struct connectdata *conn, int bytes, int *nreadp)
data->req.upload_fromhere -= (8 + 2);
}
*nreadp = 0;
}
return CURLE_OK; /* nothing was read */
}
else if((size_t)nread > buffersize) {
@ -642,7 +642,7 @@ static CURLcode readwrite_data(struct Curl_easy *data,
failf(data, "%s in chunked-encoding", Curl_chunked_strerror(res));
return CURLE_RECV_ERROR;
}
else if(CHUNKE_STOP == res) {
if(CHUNKE_STOP == res) {
size_t dataleft;
/* we're done reading chunks! */
k->keepon &= ~KEEP_RECV; /* read no more */
@ -918,7 +918,7 @@ static CURLcode readwrite_upload(struct Curl_easy *data,
/* this is a paused transfer */
break;
}
else if(nread<=0) {
if(nread<=0) {
result = done_sending(conn, k);
if(result)
return result;
@ -1192,7 +1192,7 @@ CURLcode Curl_readwrite(struct connectdata *conn,
k->size - k->bytecount);
return CURLE_PARTIAL_FILE;
}
else if(!(data->set.opt_no_body) &&
if(!(data->set.opt_no_body) &&
k->chunk &&
(conn->chunk.state != CHUNK_STOP)) {
/*

View File

@ -3684,7 +3684,7 @@ ConnectionExists(struct Curl_easy *data,
check->connection_id));
continue;
}
else if(check->ssl[FIRSTSOCKET].state != ssl_connection_complete) {
if(check->ssl[FIRSTSOCKET].state != ssl_connection_complete) {
foundPendingCandidate = TRUE;
DEBUGF(infof(data,
"Connection #%ld has not started SSL connect, "

View File

@ -775,7 +775,7 @@ int Curl_ossl_check_cxn(struct connectdata *conn)
(RECV_TYPE_ARG3)1, (RECV_TYPE_ARG4)MSG_PEEK);
if(nread == 0)
return 0; /* connection has been closed */
else if(nread == 1)
if(nread == 1)
return 1; /* connection still in place */
else if(nread == -1) {
int err = SOCKERRNO;
@ -2085,13 +2085,11 @@ static CURLcode ossl_connect_step1(struct connectdata *conn, int sockindex)
ssl_capath ? ssl_capath : "none");
return CURLE_SSL_CACERT_BADFILE;
}
else {
/* Just continue with a warning if no strict certificate verification
is required. */
infof(data, "error setting certificate verify locations,"
" continuing anyway:\n");
}
}
else {
/* Everything is fine. */
infof(data, "successfully set certificate verify locations:\n");
@ -2120,12 +2118,11 @@ static CURLcode ossl_connect_step1(struct connectdata *conn, int sockindex)
failf(data, "error loading CRL file: %s", ssl_crlfile);
return CURLE_SSL_CRL_BADFILE;
}
else {
/* Everything is fine. */
infof(data, "successfully load CRL file:\n");
X509_STORE_set_flags(SSL_CTX_get_cert_store(connssl->ctx),
X509_V_FLAG_CRL_CHECK|X509_V_FLAG_CRL_CHECK_ALL);
}
infof(data, " CRLfile: %s\n", ssl_crlfile);
}
@ -2253,7 +2250,7 @@ static CURLcode ossl_connect_step2(struct connectdata *conn, int sockindex)
connssl->connecting_state = ssl_connect_2_reading;
return CURLE_OK;
}
else if(SSL_ERROR_WANT_WRITE == detail) {
if(SSL_ERROR_WANT_WRITE == detail) {
connssl->connecting_state = ssl_connect_2_writing;
return CURLE_OK;
}
@ -3066,17 +3063,15 @@ static CURLcode ossl_connect_common(struct connectdata *conn,
failf(data, "select/poll on SSL socket, errno: %d", SOCKERRNO);
return CURLE_SSL_CONNECT_ERROR;
}
else if(0 == what) {
if(0 == what) {
if(nonblocking) {
*done = FALSE;
return CURLE_OK;
}
else {
/* timeout */
failf(data, "SSL connection timeout");
return CURLE_OPERATION_TIMEDOUT;
}
}
/* socket is readable or writable */
}
@ -3145,7 +3140,6 @@ bool Curl_ossl_data_pending(const struct connectdata *conn, int connindex)
(conn->proxy_ssl[connindex].handle &&
0 != SSL_pending(conn->proxy_ssl[connindex].handle))) ?
TRUE : FALSE;
else
return FALSE;
}

View File

@ -515,7 +515,7 @@ int Curl_ssl_getsock(struct connectdata *conn, curl_socket_t *socks,
socks[0] = conn->sock[FIRSTSOCKET];
return GETSOCK_WRITESOCK(0);
}
else if(connssl->connecting_state == ssl_connect_2_reading) {
if(connssl->connecting_state == ssl_connect_2_reading) {
/* read mode */
socks[0] = conn->sock[FIRSTSOCKET];
return GETSOCK_READSOCK(0);

View File

@ -128,7 +128,6 @@ size_t tool_header_cb(void *ptr, size_t size, size_t nmemb, void *userdata)
hdrcbdata->honor_cd_filename = FALSE;
break;
}
else
return failure;
}
}

View File

@ -783,13 +783,12 @@ ParameterError getparameter(char *flag, /* f or -long-flag */
if(!url)
return PARAM_NO_MEM;
else {
/* fill in the URL */
GetStr(&url->url, nextarg);
url->flags |= GETOUT_URL;
}
}
}
break;
case '$': /* more options without a short option */
switch(subletter) {
@ -878,7 +877,7 @@ ParameterError getparameter(char *flag, /* f or -long-flag */
&config->localportrange);
if(!rc)
return PARAM_BAD_USE;
else if(rc == 1)
if(rc == 1)
config->localportrange = 1; /* default number of ports to try */
else {
config->localportrange -= config->localport;
@ -1728,7 +1727,7 @@ ParameterError getparameter(char *flag, /* f or -long-flag */
if(!url)
return PARAM_NO_MEM;
else {
/* fill in the outfile */
if('o' == letter) {
GetStr(&url->outfile, nextarg);
@ -1743,7 +1742,6 @@ ParameterError getparameter(char *flag, /* f or -long-flag */
}
url->flags |= GETOUT_OUTFILE;
}
}
break;
case 'P':
/* This makes the FTP sessions use PORT instead of PASV */
@ -1867,7 +1865,7 @@ ParameterError getparameter(char *flag, /* f or -long-flag */
if(!url)
return PARAM_NO_MEM;
else {
url->flags |= GETOUT_UPLOAD; /* mark -T used */
if(!*nextarg)
url->flags |= GETOUT_NOUPLOAD;
@ -1876,7 +1874,6 @@ ParameterError getparameter(char *flag, /* f or -long-flag */
GetStr(&url->infile, nextarg);
}
}
}
break;
case 'u':
/* user:password */

View File

@ -207,7 +207,6 @@ static bool ttyecho(bool enable, int fd)
#endif
return TRUE; /* disabled */
}
else {
/* re-enable echo, assumes we disabled it before (and set the structs we
now use to reset the terminal status) */
#ifdef HAVE_TERMIOS_H
@ -219,7 +218,6 @@ static bool ttyecho(bool enable, int fd)
#endif
return TRUE; /* enabled */
}
}
char *getpass_r(const char *prompt, /* prompt to display */
char *password, /* buffer to store password in */

View File

@ -135,7 +135,6 @@ double tool_tvdiff_secs(struct timeval newer, struct timeval older)
if(newer.tv_sec != older.tv_sec)
return (double)(newer.tv_sec-older.tv_sec)+
(double)(newer.tv_usec-older.tv_usec)/1000000.0;
else
return (double)(newer.tv_usec-older.tv_usec)/1000000.0;
}