Skip to content

Commit 0b44657

Browse files
committed
chore: revert sidecar ffi changes that are breaking
We can keep those for later, after confirming they make sense.
1 parent e42fb9c commit 0b44657

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

datadog-sidecar-ffi/src/span.rs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,9 +142,14 @@ pub extern "C" fn ddog_get_traces_size(traces: &TracesBytes) -> usize {
142142
// can return values as `Option<&/&mut>` that will have the same ABI `*const/*mut TraceBytes`, with
143143
// `None` corresponding to `null`.
144144

145+
// I don't think we need to return a mutable reference here, but when changing the return value
146+
// from `*mut` to `Option<&mut>`, we wanted to preserve the FFI at first.
145147
#[no_mangle]
146-
pub extern "C" fn ddog_get_trace(traces: &mut TracesBytes, index: usize) -> Option<&TraceBytes> {
147-
traces.get(index)
148+
pub extern "C" fn ddog_get_trace(
149+
traces: &mut TracesBytes,
150+
index: usize,
151+
) -> Option<&mut TraceBytes> {
152+
traces.get_mut(index)
148153
}
149154

150155
// ------------------ TraceBytes ------------------
@@ -159,9 +164,11 @@ pub extern "C" fn ddog_get_trace_size(trace: &TraceBytes) -> usize {
159164
trace.len()
160165
}
161166

167+
// I don't think we need to return a mutable reference here, but when changing the return value
168+
// from `*mut` to `Option<&mut>`, we wanted to preserve the FFI at first.
162169
#[no_mangle]
163-
pub extern "C" fn ddog_get_span(trace: &mut TraceBytes, index: usize) -> Option<&SpanBytes> {
164-
trace.get(index)
170+
pub extern "C" fn ddog_get_span(trace: &mut TraceBytes, index: usize) -> Option<&mut SpanBytes> {
171+
trace.get_mut(index)
165172
}
166173

167174
// ------------------- SpanBytes -------------------

0 commit comments

Comments
 (0)