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 allocation in ObjectIdentifier::from_str #14

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Rawk
Copy link

@Rawk Rawk commented Mar 28, 2024

No description provided.

@RavuAlHemio
Copy link
Owner

Hmm, this change has an effect on the semantics of the obtained field of ObjectIdentifierConversionError::TooLong. Instead of setting it to index + 1, which is not necessarily true (and always ends up being MAX_SUB_IDENTIFIER_COUNT + 1), I'd either get rid of it or run through the split the OID string twice -- once to get the number of sub-identifiers, once to parse them.

What's your take?

@Rawk Rawk force-pushed the obj-ident-no-alloc-parse branch from 7b6028e to 4447790 Compare April 2, 2024 07:20
@Rawk Rawk force-pushed the obj-ident-no-alloc-parse branch from 4447790 to 6fb36a5 Compare April 2, 2024 07:41
@Rawk
Copy link
Author

Rawk commented Apr 2, 2024

I think that it can be nice to include obtained. I have changed the commits to fix this:

  • Get the obtained value by counting how many iterations are left.
  • Add a test that verifies that obtained can exceed MAX_SUB_IDENTIFIER_COUNT + 1.
  • Rebase.

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.

None yet

2 participants