Skip to content

Hex encoding and byte buf utilities #328

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

Merged
merged 6 commits into from
May 1, 2019
Merged

Hex encoding and byte buf utilities #328

merged 6 commits into from
May 1, 2019

Conversation

bretambrose
Copy link
Contributor

New hex encoding variant that does not 0-terminate, resizes as needed, and respects the buffers current position.

New reserve invariant that performs its resizing calculation relative to the current length. Useful to cut down on the number of checked arithmetic operations needed when using reserve.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Bret Ambrose and others added 4 commits May 1, 2019 10:10
Copy link
Contributor

@justinboswell justinboswell left a comment

Choose a reason for hiding this comment

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

LGTM, other than the naming

*
*/
AWS_COMMON_API
int aws_byte_buf_reserve_from_len(struct aws_byte_buf *buffer, size_t additional_length);
Copy link
Contributor

Choose a reason for hiding this comment

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

[nitpick] Feels like _grow or _expand or _extend, do we not have this pattern anywhere else? reserve_from_len just feels a bit unintuitive to me offhand.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

_reserve_relative was another possibility

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.

3 participants