File tree 1 file changed +4
-5
lines changed
1 file changed +4
-5
lines changed Original file line number Diff line number Diff line change 1
1
//! Store and manipulate Kafka messages.
2
2
3
- use std:: ffi:: { CStr , CString } ;
3
+ use std:: ffi:: CStr ;
4
4
use std:: fmt;
5
5
use std:: marker:: PhantomData ;
6
- use std:: os:: raw:: c_void;
6
+ use std:: os:: raw:: { c_char , c_void} ;
7
7
use std:: ptr;
8
8
use std:: str;
9
9
use std:: sync:: Arc ;
@@ -534,7 +534,6 @@ impl OwnedHeaders {
534
534
where
535
535
V : ToBytes + ?Sized ,
536
536
{
537
- let name_cstring = CString :: new ( header. key ) . unwrap ( ) ;
538
537
let ( value_ptr, value_len) = match header. value {
539
538
None => ( ptr:: null_mut ( ) , 0 ) ,
540
539
Some ( value) => {
@@ -548,8 +547,8 @@ impl OwnedHeaders {
548
547
let err = unsafe {
549
548
rdsys:: rd_kafka_header_add (
550
549
self . ptr ( ) ,
551
- name_cstring . as_ptr ( ) ,
552
- name_cstring . as_bytes ( ) . len ( ) as isize ,
550
+ header . key . as_ptr ( ) as * const c_char ,
551
+ header . key . as_bytes ( ) . len ( ) as isize ,
553
552
value_ptr,
554
553
value_len,
555
554
)
You can’t perform that action at this time.
0 commit comments