Skip to content

Commit bc36b10

Browse files
authored
fix libc char for unix (#1846)
<!-- ELLIPSIS_HIDDEN --> > [!IMPORTANT] > Change `error_callback_fn` calls in `safe_trigger_callback` to use `i8` instead of `libc::c_char` for error message pointers. > > - **Behavior**: > - Change `error_callback_fn` calls in `safe_trigger_callback` to use `i8` instead of `libc::c_char` for error message pointers. > - **Functions**: > - Affects `safe_trigger_callback` in `lib.rs` by changing the type of error message pointers. > - **Misc**: > - Simplifies error callback function calls by removing redundant type casting. > > <sup>This description was created by </sup>[<img alt="Ellipsis" src="https://img.shields.io/badge/Ellipsis-blue?color=175173">](https://www.ellipsis.dev?ref=BoundaryML%2Fbaml&utm_source=github&utm_medium=referral)<sup> for 88497d7. You can [customize](https://app.ellipsis.dev/BoundaryML/settings/summaries) this summary. It will automatically update as commits are pushed.</sup> <!-- ELLIPSIS_HIDDEN -->
1 parent 774c5c6 commit bc36b10

File tree

1 file changed

+3
-18
lines changed
  • engine/language_client_cffi/src

1 file changed

+3
-18
lines changed

engine/language_client_cffi/src/lib.rs

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -137,31 +137,16 @@ fn safe_trigger_callback(id: u32, is_done: bool, result: Result<FunctionResult>)
137137
Some(Err(e)) => {
138138
// let c_message = CString::new(e.to_string()).unwrap();
139139
let message = e.to_string();
140-
error_callback_fn(
141-
id,
142-
true,
143-
message.as_ptr() as *const libc::c_char,
144-
message.len(),
145-
);
140+
error_callback_fn(id, true, message.as_ptr() as *const i8, message.len());
146141
}
147142
None => {
148143
let message = "No result from baml".to_string();
149-
error_callback_fn(
150-
id,
151-
true,
152-
message.as_ptr() as *const libc::c_char,
153-
message.len(),
154-
);
144+
error_callback_fn(id, true, message.as_ptr() as *const i8, message.len());
155145
}
156146
},
157147
Err(e) => {
158148
let message = format!("Error: {}", e);
159-
error_callback_fn(
160-
id,
161-
true,
162-
message.as_ptr() as *const libc::c_char,
163-
message.len(),
164-
);
149+
error_callback_fn(id, true, message.as_ptr() as *const i8, message.len());
165150
}
166151
}
167152
}

0 commit comments

Comments
 (0)