Skip to content

Commit

Permalink
fix variable [-Wunused-but-set-variable] warnings (#2243)
Browse files Browse the repository at this point in the history
  • Loading branch information
thorneliu authored May 23, 2023
1 parent cb7a6ff commit d5327f6
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 7 deletions.
3 changes: 1 addition & 2 deletions src/brpc/details/hpack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -489,8 +489,7 @@ inline void EncodeInteger(butil::IOBufAppender* out, uint8_t msb,
value -= max_prefix_value;
msb |= max_prefix_value;
out->push_back(msb);
size_t out_bytes = 1;
for (; value >= 128; ++out_bytes) {
for (; value >= 128; ) {
const uint8_t c = (value & 0x7f) | 0x80;
value >>= 7;
out->push_back(c);
Expand Down
2 changes: 1 addition & 1 deletion src/brpc/span.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -749,7 +749,7 @@ void ListSpans(int64_t starting_realtime, size_t max_scan,
}
BriefSpan brief;
size_t nscan = 0;
for (size_t i = 0; nscan < max_scan && it->Valid(); ++i, it->Prev()) {
for (; nscan < max_scan && it->Valid(); it->Prev()) {
const int64_t key_tm = ToLittleEndian((const uint32_t*)it->key().data());
// May have some bigger time at the beginning, because leveldb returns
// keys >= starting_realtime.
Expand Down
4 changes: 0 additions & 4 deletions src/bvar/detail/sampler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,6 @@ void SamplerCollector::run() {
if (s) {
s->InsertBeforeAsList(&root);
}
int nremoved = 0;
int nsampled = 0;
for (butil::LinkNode<Sampler>* p = root.next(); p != &root;) {
// We may remove p from the list, save next first.
butil::LinkNode<Sampler>* saved_next = p->next();
Expand All @@ -171,11 +169,9 @@ void SamplerCollector::run() {
s->_mutex.unlock();
p->RemoveFromList();
delete s;
++nremoved;
} else {
s->take_sample();
s->_mutex.unlock();
++nsampled;
}
p = saved_next;
}
Expand Down

0 comments on commit d5327f6

Please sign in to comment.