Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Fix compilation errors reported by clang-14 (#2242) #2243

Merged
merged 1 commit into from
May 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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