Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Avoid unnecessary realloc when creating C-style strings #711

Closed
wants to merge 1 commit into from
Closed
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
2 changes: 1 addition & 1 deletion rdkafka-sys/librdkafka
2 changes: 1 addition & 1 deletion src/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,7 @@ impl OwnedHeaders {
where
V: ToBytes + ?Sized,
{
let name_cstring = CString::new(header.key.to_owned()).unwrap();
let name_cstring = CString::new(header.key).unwrap();
let (value_ptr, value_len) = match header.value {
None => (ptr::null_mut(), 0),
Some(value) => {
Expand Down
2 changes: 1 addition & 1 deletion src/producer/base_producer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ where
}
let (payload_ptr, payload_len) = as_bytes(record.payload);
let (key_ptr, key_len) = as_bytes(record.key);
let topic_cstring = CString::new(record.topic.to_owned()).unwrap();
let topic_cstring = CString::new(record.topic).unwrap();
let opaque_ptr = record.delivery_opaque.into_ptr();
let produce_error = unsafe {
rdsys::rd_kafka_producev(
Expand Down
Loading