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

Get rid of CString alloc in OwnedHeader::insert #713

Merged

Conversation

mlowicki
Copy link
Collaborator

@mlowicki mlowicki commented Aug 28, 2024

We pass length of header's key so in such case librdkafka doesn't calculate name's length and relies on the passed value. Additionally it adds null byte at the end - https://github.com/confluentinc/librdkafka/blob/10f988f493695ee2ff180d9927f1e881ab98a36d/src/rdkafka_header.c#L96 so no point of creating c string in rust code.

I think that issue is there since forever - 56366ae#diff-e070e0bbef3fd7da263a02197f5b3ba50d6b086f1a882a639dcf70a03db48704R376. The logic to add \0 in librdkafka code base seems also present since forever - https://github.com/confluentinc/librdkafka/pull/1480/files#diff-7daf545224b7aa45b8eeecc8f32b1e07815e64fc6dae003af54ee4a96810a995R97

@mlowicki mlowicki force-pushed the mlowicki/optimise_ownedheaders_insert branch from a3e796c to a2bd0f3 Compare August 28, 2024 07:31
@mlowicki mlowicki marked this pull request as ready for review August 29, 2024 11:42
Copy link
Collaborator

@davidblewett davidblewett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

@davidblewett davidblewett merged commit f71185c into fede1024:master Oct 8, 2024
6 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants