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

Only increase the size of the stack if required #671

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tessereth
Copy link

Hi! I was looking through this code for unrelated reasons and happened to notice that redcarpet_stack_push is calling redcarpet_stack_grow significantly more often than necessary. My assumption from reading the code is that it should only allocate more memory if their's insufficient space but this is increasing the buffer size on every push so there's always double the space required.

Your contributing guide says to add a test but as far as I can tell there's no way to test C code directly so I'm not sure that's a feasible thing to do in this case. Please let me know if there is a way to test this and I'd be happy to add it. This does not appear to effect the benchmark in any way.

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.

1 participant