Skip to content
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
10 changes: 6 additions & 4 deletions src/brpc/span.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ Span* Span::CreateClientSpan(const std::string& full_method_name,
span->_tls_next = NULL;
span->_full_method_name = full_method_name;
span->_info.clear();
Span* parent = (Span*)bthread::tls_bls.rpcz_parent_span;
Span* parent = static_cast<Span*>(bthread::tls_bls.rpcz_parent_span);
if (parent) {
span->_trace_id = parent->trace_id();
span->_parent_span_id = parent->span_id();
Expand All @@ -148,7 +148,7 @@ Span* Span::CreateClientSpan(const std::string& full_method_name,

Span* Span::CreateBthreadSpan(const std::string& full_method_name,
int64_t base_real_us) {
Span* parent = (Span*)bthread::tls_bls.rpcz_parent_span;
Span* parent = static_cast<Span*>(bthread::tls_bls.rpcz_parent_span);
if (parent == NULL) {
return NULL;
}
Expand Down Expand Up @@ -349,7 +349,7 @@ bool CanAnnotateSpan() {
}

void AnnotateSpan(const char* fmt, ...) {
Span* span = (Span*)bthread::tls_bls.rpcz_parent_span;
Span* span = static_cast<Span*>(bthread::tls_bls.rpcz_parent_span);
va_list ap;
va_start(ap, fmt);
span->Annotate(fmt, ap);
Expand Down Expand Up @@ -406,7 +406,9 @@ static bvar::DisplaySamplingRatio s_display_sampling_ratio(

struct SpanEarlier {
bool operator()(bvar::Collected* c1, bvar::Collected* c2) const {
return ((Span*)c1)->GetStartRealTimeUs() < ((Span*)c2)->GetStartRealTimeUs();
const Span* span1 = static_cast<const Span*>(c1);
const Span* span2 = static_cast<const Span*>(c2);
return span1->GetStartRealTimeUs() < span2->GetStartRealTimeUs();
}
};
class SpanPreprocessor : public bvar::CollectorPreprocessor {
Expand Down
4 changes: 2 additions & 2 deletions src/brpc/span.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ friend class SpanDB;

Span* local_parent() const { return _local_parent; }
static Span* tls_parent() {
return (Span*)bthread::tls_bls.rpcz_parent_span;
return static_cast<Span*>(bthread::tls_bls.rpcz_parent_span);
}

uint64_t trace_id() const { return _trace_id; }
Expand Down Expand Up @@ -151,7 +151,7 @@ friend class SpanDB;
bvar::CollectorPreprocessor* preprocessor();

void EndAsParent() {
if (this == (Span*)bthread::tls_bls.rpcz_parent_span) {
if (this == static_cast<Span*>(bthread::tls_bls.rpcz_parent_span)) {
bthread::tls_bls.rpcz_parent_span = NULL;
}
}
Expand Down
Loading