-
Notifications
You must be signed in to change notification settings - Fork 464
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
Expose mem allocator on C-API #1983
Conversation
ship it! 😅 |
Also a broader plan would be to replace all internal malloc/free so that they go through this API to allocate things (and internally also all C++ objects would use the same allocator), so that custom mem allocator could then be pluggable. |
LGTM - Thanks @mgreter ! 🎉 |
5f58e50
to
38fc2a7
Compare
5422da5
to
47d2cab
Compare
47d2cab
to
913150f
Compare
I plan to release 3.3.5 this week. I'd do it sooner but I'm at a conference. @mgreter can you please get started on some release notes for this change? |
can we At the moment I am using local patch to make it work: // to allocate buffer to be filled
-void* sass_alloc_memory(size_t size);
+ADDAPI void* ADDCALL sass_alloc_memory(size_t size);
// to allocate a buffer from existing string
-char* sass_copy_c_string(const char* str);
+ADDAPI char* ADDCALL sass_copy_c_string(const char* str);
// to free overtaken memory when done
-void sass_free_memory(void* ptr);
+ADDAPI void ADDCALL sass_free_memory(void* ptr); |
Combining #1973 and #1821
Adds the following new C-API functions:
void* sass_alloc_memory(size_t size)
char* sass_copy_c_string(const char* str)
void sass_free_memory(void* ptr)
IMO this should be future proof and both linked issues should be covered.
Sass::sass_strdup
I suggest to add them with #1974 to 3.3.5 as incubating features for 3.4.0.
//CC @xoofx, @am11, @drewwells