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

Way of removing malloc completely #99

Closed
DeanoC opened this issue Mar 15, 2022 · 2 comments · Fixed by #104
Closed

Way of removing malloc completely #99

DeanoC opened this issue Mar 15, 2022 · 2 comments · Fixed by #104

Comments

@DeanoC
Copy link

DeanoC commented Mar 15, 2022

At the moment, we can pass alloc_func_ptr into functions that need to allocate memory but the malloc path is still live and for bare metal platforms that don't have an actual malloc in the c lib is won't compile, would be nice if a define could remove the malloc call completely... Happy to fail if no malloc, I'll always be passing alloc_func_ptr.

For now I've just defined it out like so
#if UTF8_NO_STD_MALLOC
//No malloc, you must pass in alloc_func_ptr
assert(false);
#else
n = (utf8_int8_t *)malloc(bytes);
#endif

@sheredom
Copy link
Owner

That's seems reasonable, I'll add that!

@sheredom
Copy link
Owner

sheredom commented Jul 4, 2022

@DeanoC sorry for taking so long - I've had my head up my arse! I decided to not rely on assert.h, and just return NULL if you try use the malloc path with UTF8_NO_STD_MALLOC defined. Fixed in #104!

sheredom added a commit that referenced this issue Jul 5, 2022
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