You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by zw...@apache.org on 2021/11/08 18:48:30 UTC
[trafficserver] branch 9.2.x updated: Fix unused-but-set-variable
warnings (#8435)
This is an automated email from the ASF dual-hosted git repository.
zwoop pushed a commit to branch 9.2.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/9.2.x by this push:
new 8feb91e Fix unused-but-set-variable warnings (#8435)
8feb91e is described below
commit 8feb91edc33a7b787d9cf762404a6c1b9bd4d127
Author: Masaori Koshiba <ma...@apache.org>
AuthorDate: Wed Oct 20 08:12:44 2021 +0900
Fix unused-but-set-variable warnings (#8435)
(cherry picked from commit fcc7268f8c00daeac1a10107dc2aad6f1b01077e)
---
mgmt/api/CoreAPIShared.cc | 3 ---
plugins/esi/lib/EsiGunzip.cc | 2 --
plugins/experimental/statichit/statichit.cc | 4 +---
plugins/generator/generator.cc | 4 +---
src/traffic_logcat/logcat.cc | 3 +--
tests/gold_tests/tls/ssl-post.c | 2 --
6 files changed, 3 insertions(+), 15 deletions(-)
diff --git a/mgmt/api/CoreAPIShared.cc b/mgmt/api/CoreAPIShared.cc
index dcf56b9..dc580ac 100644
--- a/mgmt/api/CoreAPIShared.cc
+++ b/mgmt/api/CoreAPIShared.cc
@@ -142,7 +142,6 @@ TSMgmtError
sendHTTPRequest(int sock, char *req, uint64_t timeout)
{
char request[BUFSIZ];
- char *requestPtr;
size_t length = 0;
memset(request, 0, BUFSIZ);
@@ -158,7 +157,6 @@ sendHTTPRequest(int sock, char *req, uint64_t timeout)
goto error;
}
// Write the request to the server.
- requestPtr = request;
while (length > 0) {
do {
err = write(sock, request, length);
@@ -168,7 +166,6 @@ sendHTTPRequest(int sock, char *req, uint64_t timeout)
// printf("(test) write failed [%d '%s']\n", errno, strerror (errno));
goto error;
}
- requestPtr += err;
length -= err;
}
diff --git a/plugins/esi/lib/EsiGunzip.cc b/plugins/esi/lib/EsiGunzip.cc
index 167b664..3b24fdc 100644
--- a/plugins/esi/lib/EsiGunzip.cc
+++ b/plugins/esi/lib/EsiGunzip.cc
@@ -78,7 +78,6 @@ EsiGunzip::stream_decode(const char *data, int data_len, std::string &udata)
_zstrm.avail_in = data_len;
char raw_buf[BUF_SIZE];
int inflate_result;
- int32_t unzipped_data_size = 0;
int32_t curr_buf_size;
do {
@@ -99,7 +98,6 @@ EsiGunzip::stream_decode(const char *data, int data_len, std::string &udata)
_errorLog("[%s] buf below zero", __FUNCTION__);
break;
}
- unzipped_data_size += curr_buf_size;
// push empty object onto list and add data to in-list object to
// avoid data copy for temporary
diff --git a/plugins/experimental/statichit/statichit.cc b/plugins/experimental/statichit/statichit.cc
index b134e5a..4cca0f4 100644
--- a/plugins/experimental/statichit/statichit.cc
+++ b/plugins/experimental/statichit/statichit.cc
@@ -366,7 +366,6 @@ StaticHitInterceptHook(TSCont contp, TSEvent event, void *edata)
VDEBUG("reading vio=%p vc=%p, trq=%p", arg.vio, TSVIOVConnGet(arg.vio), cdata.trq);
TSIOBufferBlock blk;
- ssize_t consumed = 0;
TSParseResult result = TS_PARSE_CONT;
for (blk = TSIOBufferReaderStart(cdata.trq->readio.reader); blk; blk = TSIOBufferBlockNext(blk)) {
@@ -408,8 +407,7 @@ StaticHitInterceptHook(TSCont contp, TSEvent event, void *edata)
return TS_EVENT_NONE;
case TS_PARSE_CONT:
- // We consumed the buffer we got minus the remainder.
- consumed += (nbytes - std::distance(ptr, end));
+ break;
}
}
diff --git a/plugins/generator/generator.cc b/plugins/generator/generator.cc
index a1177fb..9afedd8 100644
--- a/plugins/generator/generator.cc
+++ b/plugins/generator/generator.cc
@@ -538,7 +538,6 @@ GeneratorInterceptHook(TSCont contp, TSEvent event, void *edata)
VDEBUG("reading vio=%p vc=%p, grq=%p", arg.vio, TSVIOVConnGet(arg.vio), cdata.grq);
- ssize_t consumed = 0;
TSParseResult result = TS_PARSE_CONT;
if (cdata.grq->status == TS_HTTP_STATUS_OK && cdata.grq->flags & GeneratorRequest::ISPOST) {
@@ -642,8 +641,7 @@ GeneratorInterceptHook(TSCont contp, TSEvent event, void *edata)
return TS_EVENT_NONE;
case TS_PARSE_CONT:
- // We consumed the buffer we got minus the remainder.
- consumed += (nbytes - std::distance(ptr, end));
+ break;
}
}
diff --git a/src/traffic_logcat/logcat.cc b/src/traffic_logcat/logcat.cc
index 5ac69aa..9f398dc 100644
--- a/src/traffic_logcat/logcat.cc
+++ b/src/traffic_logcat/logcat.cc
@@ -119,7 +119,6 @@ process_file(int in_fd, int out_fd)
{
char buffer[MAX_LOGBUFFER_SIZE];
int nread, buffer_bytes;
- unsigned bytes = 0;
while (true) {
// read the next buffer from file descriptor
@@ -200,7 +199,7 @@ process_file(int in_fd, int out_fd)
// convert the buffer to ascii entries and place onto stdout
//
if (header->fmt_fieldlist()) {
- bytes += LogFile::write_ascii_logbuffer(header, out_fd, ".", alt_format);
+ LogFile::write_ascii_logbuffer(header, out_fd, ".", alt_format);
} else {
// TODO investigate why this buffer goes wonky
}
diff --git a/tests/gold_tests/tls/ssl-post.c b/tests/gold_tests/tls/ssl-post.c
index eeb8037..0df6ad8 100644
--- a/tests/gold_tests/tls/ssl-post.c
+++ b/tests/gold_tests/tls/ssl-post.c
@@ -161,14 +161,12 @@ spawn_same_session_send(void *arg)
char input_buf[1024];
int read_bytes = SSL_read(ssl, input_buf, sizeof(input_buf));
- int total_read = 0;
while (read_bytes != 0) {
fd_set reads;
fd_set writes;
FD_ZERO(&reads);
FD_ZERO(&writes);
if (read_bytes > 0) {
- total_read += read_bytes;
FD_SET(sfd, &reads);
} else {
int error = SSL_get_error(ssl, read_bytes);