]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw/rgw_rest: do not set unused variable
authorKefu Chai <kchai@redhat.com>
Mon, 16 Aug 2021 09:26:09 +0000 (17:26 +0800)
committerKefu Chai <kchai@redhat.com>
Mon, 16 Aug 2021 09:26:10 +0000 (17:26 +0800)
`len` is used to track the total length of received data, but we already
collect the data in `bl`, so we can always check `bl` for the total
length. this change also silences following warning from Clang:

../src/rgw/rgw_rest.cc:1477:21: warning: variable 'len' set but not used [-Wunused-but-set-variable]
  int read_len = 0, len = 0;
                    ^
1 warning generated.

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/rgw/rgw_rest.cc

index a07bd2500b9b5f9fc5a029de5633fa8aac93dbf3..c3389a43e28deefb27f72714f51157ae6660015f 100644 (file)
@@ -1474,7 +1474,7 @@ static std::tuple<int, bufferlist> read_all_chunked_input(req_state *s, const ui
   int total = need_to_read;
   bufferlist bl;
 
-  int read_len = 0, len = 0;
+  int read_len = 0;
   do {
     bufferptr bp(need_to_read + 1);
     read_len = recv_body(s, bp.c_str(), need_to_read);
@@ -1485,7 +1485,6 @@ static std::tuple<int, bufferlist> read_all_chunked_input(req_state *s, const ui
     bp.c_str()[read_len] = '\0';
     bp.set_length(read_len);
     bl.append(bp);
-    len += read_len;
 
     if (read_len == need_to_read) {
       if (need_to_read < MAX_READ_CHUNK)