Remove the buffer argument from loc_getenv
1.Avoid to allocate the big buffer on the caller stack 2.The temporary buffer is only used on cygwin
@j256 we are porting dmalloc to RTOS environment, it's critical to reduce the stack consumption as much as possbile.
Thanks for this. Can you instead make the change where it is used. So revert the changes to loc_compat.[ch] and user_malloc.[ch] and make the dmalloc_t.c, dmalloc.c, dmalloc_argv.c, and user_malloc.c define it statically? Then it is up to the caller to ensure that we are in single thread mode.
Since the buffer is only needed for cygwin, it isn't good to expose the buffer allocation outside loc_getenv to pollute other platform. I I add __thread to make buf become per thread, could you take a look?
Don't think of portability as polluting. The __thread feels a lot less portable.
__thread is only used in cygwin, and I test that cygwin's clang and gcc both support __thread. So the portability isn't problem here.
@j256 I fix the problem by macro to avoid __thread, please review again.
@j256 could you take time to review my patch?