Skip to content

Commit d9275b8

Browse files
bm1549claude
andcommitted
Fix clang-format violation and logic bug in ksr error handling
Fix two issues introduced by GitHub suggestion commits: 1. Correct the error condition: `ec == std::errc()` means success, not failure — changed to `ec != std::errc()` to properly detect errors. 2. Fix indentation from 4-space to 2-space to match project style and pass clang-format checks. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 4d94043 commit d9275b8

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

src/datadog/trace_segment.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -331,11 +331,11 @@ void TraceSegment::make_sampling_decision_if_null() {
331331
const auto [ptr, ec] = std::to_chars(buf.data(), buf.data() + buf.size(),
332332
*sampling_decision_->configured_rate,
333333
std::chars_format::general, 6);
334-
if (ec == std::errc()) {
335-
std::string error{"string conversion failed: "};
336-
error += std::make_error_code(ec).message();
337-
logger_->log_error(error);
338-
return;
334+
if (ec != std::errc()) {
335+
std::string error{"string conversion failed: "};
336+
error += std::make_error_code(ec).message();
337+
logger_->log_error(error);
338+
return;
339339
}
340340
trace_tags_.emplace_back(tags::internal::ksr, std::string(buf.data(), ptr));
341341
}

0 commit comments

Comments
 (0)