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

Allow programmer specified allocator #84

Closed
warmwaffles opened this issue Feb 18, 2021 · 2 comments · Fixed by #85
Closed

Allow programmer specified allocator #84

warmwaffles opened this issue Feb 18, 2021 · 2 comments · Fixed by #85

Comments

@warmwaffles
Copy link
Contributor

Would be nice to maybe provide a way for the person including the utf8 code to be able to do something like

#define utf8malloc my_alloc
#include "utf8.h"

I would make a PR to do this, but I don't know if it would be anything anyone is interested in.

@sheredom
Copy link
Owner

There is only two entry points utf8dup and utf8ndup that use malloc - I think I'd rather add utf8dup_ex that takes a user provided allocator to do this (similar to the user allocator in my other lib json.h. Thoughts?

@warmwaffles
Copy link
Contributor Author

I think that would work too. Rationale is that I am using this library for some small stuff in an erlang NIF and would prefer to use erlang's allocator and deallocator there.

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 a pull request may close this issue.

2 participants